mirror of
https://github.com/openstf/stf
synced 2025-10-04 18:29:17 +02:00
Add ldap username field option. Default field is 'cn'
This commit is contained in:
parent
b61df410f7
commit
5618e68cb4
2 changed files with 8 additions and 1 deletions
|
@ -360,6 +360,10 @@ program
|
||||||
, 'LDAP search field (or $LDAP_SEARCH_FIELD)'
|
, 'LDAP search field (or $LDAP_SEARCH_FIELD)'
|
||||||
, String
|
, String
|
||||||
, process.env.LDAP_SEARCH_FIELD)
|
, process.env.LDAP_SEARCH_FIELD)
|
||||||
|
.option('--ldap-username-field <scope>'
|
||||||
|
, 'LDAP username field (or $LDAP_USERNAME_FIELD)'
|
||||||
|
, String
|
||||||
|
, process.env.LDAP_USERNAME_FIELD || 'cn')
|
||||||
.action(function(options) {
|
.action(function(options) {
|
||||||
if (!options.secret) {
|
if (!options.secret) {
|
||||||
this.missingArgument('--secret')
|
this.missingArgument('--secret')
|
||||||
|
@ -386,6 +390,9 @@ program
|
||||||
, objectClass: options.ldapSearchClass
|
, objectClass: options.ldapSearchClass
|
||||||
, field: options.ldapSearchField
|
, field: options.ldapSearchField
|
||||||
}
|
}
|
||||||
|
, username: {
|
||||||
|
field: options.ldapUsernameField
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -79,7 +79,7 @@ module.exports = function(options) {
|
||||||
var token = jwtutil.encode({
|
var token = jwtutil.encode({
|
||||||
payload: {
|
payload: {
|
||||||
email: ldaputil.email(user)
|
email: ldaputil.email(user)
|
||||||
, name: user.cn
|
, name: user[options.ldap.username.field]
|
||||||
}
|
}
|
||||||
, secret: options.secret
|
, secret: options.secret
|
||||||
, header: {
|
, header: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue