summaryrefslogtreecommitdiff
path: root/lib/web
diff options
context:
space:
mode:
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]