Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new attributes option to LdapAuth #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/ldapauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ var LDAP_PROXY_EVENTS = [
* retry {Object} Optional:
* - maxDelay {Number} maximum amount of time between retries
* - retries {Number} maximum # of retries
* attributes {Array} Optional
* Select a subset of the ldap user object attributes, by default
* all attributes are fetched and returned.
* Useful if your ldap database contains images of users and
* you dont need the images.
*/
function LdapAuth(opts) {
assert.string(opts.url, 'opts.url');
Expand Down Expand Up @@ -110,7 +115,8 @@ function LdapAuth(opts) {
retry: opts.retry || {},
tlsOptions: opts.tlsOptions,
timeout: opts.timeout,
url: opts.url
url: opts.url,
attributes: opts.attributes || []
};
(function adminConnect() {
self._adminConnecting = self._createClient(self._adminOpts, function (err, client) {
Expand Down Expand Up @@ -286,7 +292,8 @@ LdapAuth.prototype._findUser = function (username, callback) {
var searchFilter = self.opts.searchFilter.replace('{{username}}', username);
var opts = {
filter: searchFilter,
scope: 'sub'
scope: 'sub',
attributes: self.opts.attributes
};
self._adminClient.search(self.opts.searchBase, opts,
function (err, result) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"assert-plus": "0.1.4",
"backoff": "2.3.0",
"bcrypt": "0.7.5",
"ldapjs": "git+ssh://[email protected]:mcavage/node-ldapjs.git#fa1b8c4",
"ldapjs": "0.7.1",
"lru-cache": "2.0.4",
"once": "1.3.0"
}
Expand Down