diff --git a/README.md b/README.md index a821284..ba6a396 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ Optional ldapjs options, see [ldapjs documentation](https://github.com/mcavage/n - `queueSize` - `queueTimeout` - `queueDisable` +- `timeLimit` ## How it works diff --git a/lib/ldapauth.js b/lib/ldapauth.js index 11cf04f..132bd57 100644 --- a/lib/ldapauth.js +++ b/lib/ldapauth.js @@ -99,6 +99,7 @@ function LdapAuth(opts) { socketPath: opts.socketPath, log: opts.log, timeout: opts.timeout, + timeLimit: opts.timeLimit, connectTimeout: opts.connectTimeout, idleTimeout: opts.idleTimeout, reconnect: opts.reconnect, @@ -307,6 +308,11 @@ LdapAuth.prototype._findUser = function (username, callback) { var searchFilter = self.opts.searchFilter.replace(/{{username}}/g, sanitizeInput(username)); var opts = { filter: searchFilter, scope: self.opts.searchScope }; + + if (self.opts.timeLimit){ + opts.timeLimit = self.opts.timeLimit; + } + if (self.opts.searchAttributes) { opts.attributes = self.opts.searchAttributes; } @@ -362,6 +368,11 @@ LdapAuth.prototype._findGroups = function (user, callback) { var searchFilter = self.opts.groupSearchFilter(user); var opts = { filter: searchFilter, scope: self.opts.groupSearchScope }; + + if (self.opts.timeLimit){ + opts.timeLimit = self.opts.timeLimit; + } + if (self.opts.groupSearchAttributes) { opts.attributes = self.opts.groupSearchAttributes; }