Fixes the authMode name for passport-ldapjs and add a parameter for LDAP mailTag
This commit is contained in:
parent
71737fa656
commit
2f9a75df9b
2 changed files with 6 additions and 4 deletions
|
@ -147,6 +147,8 @@ ldap:
|
||||||
uidTag: username
|
uidTag: username
|
||||||
# nameTag identifies the attribute to be used for user's full name
|
# nameTag identifies the attribute to be used for user's full name
|
||||||
nameTag: username
|
nameTag: username
|
||||||
|
# mailTag identifies the attribute to be used for user's email address
|
||||||
|
mailTag: mail
|
||||||
passwordresetlink:
|
passwordresetlink:
|
||||||
newUserRole: master
|
newUserRole: master
|
||||||
# Global namespace id
|
# Global namespace id
|
||||||
|
|
|
@ -24,7 +24,7 @@ if (config.ldap.enabled) {
|
||||||
if (!config.ldap.method || config.ldap.method === 'ldapjs') {
|
if (!config.ldap.method || config.ldap.method === 'ldapjs') {
|
||||||
try {
|
try {
|
||||||
LdapStrategy = require('passport-ldapjs').Strategy; // eslint-disable-line global-require
|
LdapStrategy = require('passport-ldapjs').Strategy; // eslint-disable-line global-require
|
||||||
authMode = 'ldapjs';
|
authMode = 'ldap';
|
||||||
log.info('LDAP', 'Found module "passport-ldapjs". It will be used for LDAP auth.');
|
log.info('LDAP', 'Found module "passport-ldapjs". It will be used for LDAP auth.');
|
||||||
|
|
||||||
ldapStrategyOpts = {
|
ldapStrategyOpts = {
|
||||||
|
@ -34,7 +34,7 @@ if (config.ldap.enabled) {
|
||||||
base: config.ldap.baseDN,
|
base: config.ldap.baseDN,
|
||||||
search: {
|
search: {
|
||||||
filter: config.ldap.filter,
|
filter: config.ldap.filter,
|
||||||
attributes: [config.ldap.uidTag, config.ldap.nameTag, 'mail'],
|
attributes: [config.ldap.uidTag, config.ldap.nameTag, config.ldap.mailTag],
|
||||||
scope: 'sub'
|
scope: 'sub'
|
||||||
},
|
},
|
||||||
uidTag: config.ldap.uidTag,
|
uidTag: config.ldap.uidTag,
|
||||||
|
@ -58,7 +58,7 @@ if (config.ldap.enabled) {
|
||||||
url: ldapProtocol + '://' + config.ldap.host + ':' + config.ldap.port,
|
url: ldapProtocol + '://' + config.ldap.host + ':' + config.ldap.port,
|
||||||
searchBase: config.ldap.baseDN,
|
searchBase: config.ldap.baseDN,
|
||||||
searchFilter: config.ldap.filter,
|
searchFilter: config.ldap.filter,
|
||||||
searchAttributes: [config.ldap.uidTag, config.ldap.nameTag, 'mail'],
|
searchAttributes: [config.ldap.uidTag, config.ldap.nameTag, config.ldap.mailTag],
|
||||||
bindDN: config.ldap.bindUser,
|
bindDN: config.ldap.bindUser,
|
||||||
bindCredentials: config.ldap.bindPassword
|
bindCredentials: config.ldap.bindPassword
|
||||||
},
|
},
|
||||||
|
@ -177,7 +177,7 @@ module.exports.restLogin = (req, res, next) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (LdapStrategy) {
|
if (LdapStrategy) {
|
||||||
log.info('Using LDAP auth (passport-' + authMode + ')');
|
log.info('Using LDAP auth (passport-' + authMode === 'ldap' ? 'ldapjs' : authMode + ')');
|
||||||
module.exports.authMethod = 'ldap';
|
module.exports.authMethod = 'ldap';
|
||||||
module.exports.isAuthMethodLocal = false;
|
module.exports.isAuthMethodLocal = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue