diff --git a/config/default.toml b/config/default.toml index e31cef4e..0f086856 100644 --- a/config/default.toml +++ b/config/default.toml @@ -114,8 +114,7 @@ host="0.0.0.0" [ldap] # enable to use ldap user backend enabled=false -host="localhost" -port=3002 +url="ldap://localhost:3002" baseDN="ou=users,dc=company" filter="(|(username={{username}})(mail={{username}}))" #Username field in LDAP (uid/cn/username) @@ -128,8 +127,7 @@ bindPassword="" [ldapauth] # Alternative LDAP implementation using the more popular passport-ldapauth library. enabled=false -host="localhost" -port=389 +url="ldap://localhost:389" # Subtree in which the searchrequest for the user is done baseDN="ou=users,dc=company" # What whe are searching for. This should return a single user. diff --git a/lib/passport.js b/lib/passport.js index 9e1f0fc0..0e52e58e 100644 --- a/lib/passport.js +++ b/lib/passport.js @@ -87,7 +87,7 @@ if (config.ldap.enabled && LdapStrategy) { let opts = { server: { - url: 'ldap://' + config.ldap.host + ':' + config.ldap.port + url: config.ldap.url }, base: config.ldap.baseDN, search: { @@ -130,7 +130,7 @@ if (config.ldap.enabled && LdapStrategy) { log.info('Using LDAP auth (passport-ldapauth)'); let opts = { server: { - url: 'ldap://' + config.ldap.host + ':' + config.ldap.port, + url: config.ldapauth.url, searchBase: config.ldapauth.baseDN, searchFilter: config.ldapauth.filter, searchAttributes: [config.ldapauth.uidTag, 'mail'],