summaryrefslogtreecommitdiff
path: root/lib/web
diff options
context:
space:
mode:
authorChristoph (Sheogorath) Kern2018-03-18 15:13:51 +0100
committerGitHub2018-03-18 15:13:51 +0100
commit5361a971886827a07518ee8cd4665d49aab4eadb (patch)
tree92d3e4fbadb37601ba78ec02080bc1a9baa56366 /lib/web
parentf6df2deb8439dda4576ee70691c98c1ab53c965d (diff)
parent638eae0dfb2cf33d58eccca371a8dc98881cc5af (diff)
Merge pull request #770 from SISheogorath/fix/ldapUUID
Add check for undefined UUID
Diffstat (limited to '')
-rw-r--r--lib/web/auth/ldap/index.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/web/auth/ldap/index.js b/lib/web/auth/ldap/index.js
index 1a5c9938..6aa9789f 100644
--- a/lib/web/auth/ldap/index.js
+++ b/lib/web/auth/ldap/index.js
@@ -23,11 +23,18 @@ passport.use(new LDAPStrategy({
tlsOptions: config.ldap.tlsOptions || null
}
}, function (user, done) {
- var uuid = user.uidNumber || user.uid || user.sAMAccountName
+ var uuid = user.uidNumber || user.uid || user.sAMAccountName || undefined
if (config.ldap.useridField && user[config.ldap.useridField]) {
uuid = user[config.ldap.useridField]
}
+ if (typeof uuid === 'undefined') {
+ throw new Error('Could not determine UUID for LDAP user. Check that ' +
+ 'either uidNumber, uid or sAMAccountName is set in your LDAP directory ' +
+ 'or use another unique attribute and configure it using the ' +
+ '"useridField" option in ldap settings.')
+ }
+
var username = uuid
if (config.ldap.usernameField && user[config.ldap.usernameField]) {
username = user[config.ldap.usernameField]