summaryrefslogtreecommitdiff
path: root/lib/web/auth/ldap
diff options
context:
space:
mode:
Diffstat (limited to 'lib/web/auth/ldap')
-rw-r--r--lib/web/auth/ldap/index.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/web/auth/ldap/index.js b/lib/web/auth/ldap/index.js
index 766c5cbc..cc0d29ad 100644
--- a/lib/web/auth/ldap/index.js
+++ b/lib/web/auth/ldap/index.js
@@ -23,9 +23,16 @@ passport.use(new LDAPStrategy({
tlsOptions: config.ldap.tlsOptions || null
}
}, function (user, done) {
+ var uuid = user.uidNumber || user.uid || user.sAMAccountName
+ var username = uuid
+
+ if (config.ldap.usernameField && user[config.ldap.usernameField]) {
+ username = user[config.ldap.usernameField]
+ }
+
var profile = {
- id: 'LDAP-' + user.uidNumber,
- username: user.uid,
+ id: 'LDAP-' + uuid,
+ username: username,
displayName: user.displayName,
emails: user.mail ? [user.mail] : [],
avatarUrl: null,