Skip to content

Commit

Permalink
Merge pull request #102 from gugan-guidanz/master
Browse files Browse the repository at this point in the history
Added option to handle search timeLimit configurable
  • Loading branch information
vesse authored Jun 6, 2024
2 parents 31896b4 + d5f53dd commit ba28fc3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Optional ldapjs options, see [ldapjs documentation](https://github.com/mcavage/n
- `queueSize`
- `queueTimeout`
- `queueDisable`
- `timeLimit`

## How it works

Expand Down
11 changes: 11 additions & 0 deletions lib/ldapauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit ba28fc3

Please sign in to comment.