File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,11 +23,18 @@ passport.use(new LDAPStrategy({
2323 tlsOptions : config . ldap . tlsOptions || null
2424 }
2525} , function ( user , done ) {
26- var uuid = user . uidNumber || user . uid || user . sAMAccountName
26+ var uuid = user . uidNumber || user . uid || user . sAMAccountName || undefined
2727 if ( config . ldap . useridField && user [ config . ldap . useridField ] ) {
2828 uuid = user [ config . ldap . useridField ]
2929 }
3030
31+ if ( typeof uuid === 'undefined' ) {
32+ throw new Error ( 'Could not determine UUID for LDAP user. Check that ' +
33+ 'either uidNumber, uid or sAMAccountName is set in your LDAP directory ' +
34+ 'or use another unique attribute and configure it using the ' +
35+ '"useridField" option in ldap settings.' )
36+ }
37+
3138 var username = uuid
3239 if ( config . ldap . usernameField && user [ config . ldap . usernameField ] ) {
3340 username = user [ config . ldap . usernameField ]
You can’t perform that action at this time.
0 commit comments