I was having some problems connecting to a balanced ldap and reading the code I found the solution undocumented.
var client = ldap.createClient({
url: config.ldap.url,
reconnect:true
});
with this option can reconnect but not rebind. I 'm working to figure out how to do a rebind after client reconnect.
@ivanhuay Did you find a solution for your problem?
@strebl Not for the moment I check the results of the query and based on that I make a rebind or not
A little late, maybe. For others enter this issue later:
// e.g. in your client's class constructor
this.ldapClient = ldap.createClient({
url: ldap_url,
reconnect: {
initialDelay: 100,
maxDelay: 1000,
failAfter: 10
}
});
const client = this.ldapClient;
// do a rebind when reconnect
this.ldapClient.on('connect', function () {
client.bind(ldap_user, ldap_pwd, err => {
if (err) {
logger.error('error while ldap binding' + err);
}
});
});
A little late, maybe. For others enter this issue later:
// e.g. in your client's class constructor this.ldapClient = ldap.createClient({ url: ldap_url, reconnect: { initialDelay: 100, maxDelay: 1000, failAfter: 10 } }); const client = this.ldapClient; // do a rebind when reconnect this.ldapClient.on('connect', function () { client.bind(ldap_user, ldap_pwd, err => { if (err) { logger.error('error while ldap binding' + err); } }); });
Will this cause bind to execute twice on the first connect?
Most helpful comment
A little late, maybe. For others enter this issue later: