From a2c60482a1c65b10517e0369675e2ab5a2dcaf0d Mon Sep 17 00:00:00 2001 From: Kristian Mide Date: Thu, 9 Oct 2014 14:52:37 +0200 Subject: [PATCH 1/2] Added new attributes option to LdapAuth --- lib/ldapauth.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/ldapauth.js b/lib/ldapauth.js index b825fc0..db662f0 100644 --- a/lib/ldapauth.js +++ b/lib/ldapauth.js @@ -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'); @@ -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) { @@ -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) { From 5e376fa5cd691a69c2a1ebdf060d5e53c3e4614c Mon Sep 17 00:00:00 2001 From: Kristian Mide Date: Thu, 9 Oct 2014 15:23:35 +0200 Subject: [PATCH 2/2] Changed ldap dependency --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c940297..c10ed46 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "assert-plus": "0.1.4", "backoff": "2.3.0", "bcrypt": "0.7.5", - "ldapjs": "git+ssh://git@github.com:mcavage/node-ldapjs.git#fa1b8c4", + "ldapjs": "0.7.1", "lru-cache": "2.0.4", "once": "1.3.0" }