From af0ec14d4d3a2286d137c6ddf873e5afc639c454 Mon Sep 17 00:00:00 2001 From: Dustin Smith Date: Fri, 15 Jan 2016 15:46:49 -0600 Subject: [PATCH] adding reconnect option and error handling --- lib/LdapLookup.js | 11 ++++++----- lib/LdapValidator.js | 3 +++ package.json | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/LdapLookup.js b/lib/LdapLookup.js index 414ca43..5d6908a 100644 --- a/lib/LdapLookup.js +++ b/lib/LdapLookup.js @@ -7,11 +7,12 @@ var LdapLookup = module.exports = function(options){ '(&(objectclass=user)(|(sAMAccountName={0})(UserPrincipalName={0})))'; this._client = options.client ? options.client : ldap.createClient({ - url: options.url, - maxConnections: 10, - bindDN: options.bindDN, - credentials: options.bindCredentials, - tlsOptions: options.tlsOptions + url: options.url, + maxConnections: options.maxConnections || 10, + bindDN: options.bindDN, + bindCredentials: options.bindCredentials, + tlsOptions: options.tlsOptions, + reconnect: options.reconnect }); this._client.on('error', function(e){ diff --git a/lib/LdapValidator.js b/lib/LdapValidator.js index 8f261a3..3ec2b42 100644 --- a/lib/LdapValidator.js +++ b/lib/LdapValidator.js @@ -21,6 +21,9 @@ LdapValidator.prototype.validate = function (username, password, callback) { var client = this._options.binder || ldap.createClient({ url: this._options.url, tlsOptions: this._options.tlsOptions }); + client.on('error', function(e){ + console.log("Error in LdapValidator", e); + }) //try bind by password client.bind(up.dn, password, function(err) { if(err) return callback(); diff --git a/package.json b/package.json index 274b784..89286b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "passport-windowsauth", - "version": "0.5.1", + "version": "0.6.0", "description": "Passport strategy for Windows Integrated Authentication (NTLM)", "main": "lib/strategy.js", "scripts": {