Skip to content

Commit

Permalink
Added option searchAttributes
Browse files Browse the repository at this point in the history
Enable defining attributes to fetch from LDAP server (see
trentm#8)
  • Loading branch information
vesse committed Aug 21, 2013
1 parent 098f0d1 commit b387599
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/ldapauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ var format = require('util').format;
* username, e.g. '(uid={{username}})'. Use the literal '{{username}}'
* to have the given username be interpolated in for the LDAP
* search.
* searchAttributes {Array} Optional, default all. Array of attributes to
* fetch from LDAP server.
* log4js {Module} Optional. The require'd log4js module to use for logging.
* logging. If given this will result in TRACE-level logging for
* ldapauth.
Expand Down Expand Up @@ -134,6 +136,9 @@ LdapAuth.prototype._findUser = function (username, callback) {

var searchFilter = self.opts.searchFilter.replace(/{{username}}/g, username);
var opts = {filter: searchFilter, scope: 'sub'};
if (self.opts.searchAttributes) {
opts.attributes = self.opts.searchAttributes;
}
self._adminClient.search(self.opts.searchBase, opts,
function (err, result) {
if (err) {
Expand Down

0 comments on commit b387599

Please sign in to comment.