Git Product home page Git Product logo

ldap-pool's Introduction

LDAP Pool - a simple client pool for LDAP connections

This API is promise-based - so as to work well with async/await flow control.

Installation

$ npm install ldap-pool --save

Usage

import {Pool, LDAPPool, LDAPPoolClient} from 'ldap-pool';

let pool = new Pool({});
let pool = Pool.create({});  // same as above

// synchronous
let client = pool.getClientSync(); // returns a LDAPPoolClient synchronously

// asynchronous
pool.getClient().then(function(c: LDAPPoolClient){
   // gets an LDAPPoolClient asynchronously (the least active client)
});

The asynchronous getClient method is preferred, because this can guarantee we use a client that is not already active. Although it shouldn't matter that much.

Here we have a full use cycle:

const pool = Pool.create({
  connOpts: {
    url: url,
    reconnect: true,
    idleTimeout: 30000
  },
  size: 4,
  dn: 'uid=cdt_main.gen,OU=Generics,O=cco.nabisco.com',
  pwd: '<pwd>'
})


let client = pool.getClientSync();

client.search('foo', {}, function(err,res){
  
  // when you're done, return the client to the pool
  // this is important for performance, but *not* imperative for functionality/correctness
  client.returnToPool();
  
});

ldap-pool's People

Contributors

oresoftware avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

kruszyk faust64

ldap-pool's Issues

Problems after pool being idle for a long time.

Hi.

I am investigating an issue with my service, and at this point my most probable guess is that LDAP pool loses data after being idle for a long time. Every morning after running idle over a night LDAP connection fails. I get anonymous bind exception despite the fact that all data are provided as env variables. Restarting container solves the issue that's why I am guessing it might be something related to being idle for few hours. Have you/anybody encounter something similar? What would be best way to verify/debug the issue?

thanks

Matt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.