diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/config/default.js | 1 | ||||
-rw-r--r-- | lib/config/environment.js | 1 | ||||
-rw-r--r-- | lib/web/auth/ldap/index.js | 5 |
3 files changed, 6 insertions, 1 deletions
diff --git a/lib/config/default.js b/lib/config/default.js index 38dc21a4..5c5ebf31 100644 --- a/lib/config/default.js +++ b/lib/config/default.js @@ -115,6 +115,7 @@ module.exports = { searchFilter: undefined, searchAttributes: undefined, usernameField: undefined, + useridField: undefined, tlsca: undefined }, saml: { diff --git a/lib/config/environment.js b/lib/config/environment.js index 640f9e07..754f97d1 100644 --- a/lib/config/environment.js +++ b/lib/config/environment.js @@ -84,6 +84,7 @@ module.exports = { searchFilter: process.env.HMD_LDAP_SEARCHFILTER, searchAttributes: toArrayConfig(process.env.HMD_LDAP_SEARCHATTRIBUTES), usernameField: process.env.HMD_LDAP_USERNAMEFIELD, + useridField: process.env.HMD_LDAP_USERIDFIELD, tlsca: process.env.HMD_LDAP_TLS_CA }, saml: { diff --git a/lib/web/auth/ldap/index.js b/lib/web/auth/ldap/index.js index cc0d29ad..c6746473 100644 --- a/lib/web/auth/ldap/index.js +++ b/lib/web/auth/ldap/index.js @@ -24,8 +24,11 @@ passport.use(new LDAPStrategy({ } }, function (user, done) { var uuid = user.uidNumber || user.uid || user.sAMAccountName - var username = uuid + if (config.ldap.useridField && user[config.ldap.useridField]) { + uuid = user[config.ldap.useridField] + } + var username = uuid if (config.ldap.usernameField && user[config.ldap.usernameField]) { username = user[config.ldap.usernameField] } |