1
0
Fork 0
mirror of https://github.com/Luzifer/nginx-sso.git synced 2024-10-18 07:34:22 +00:00

Fix: Ensure alias is set correctly when it is a DN

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-06-18 11:48:44 +02:00
parent bb079f0832
commit ed630b3edd
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -219,7 +219,13 @@ func (a authLDAP) checkLogin(username, password, aliasAttribute string) (string,
return "", "", errNoValidUserFound
}
return userDN, sres.Entries[0].GetAttributeValue(aliasAttribute), nil
alias := sres.Entries[0].GetAttributeValue(aliasAttribute)
if aliasAttribute == "dn" {
// DN is not fetchable through GetAttributeValue as it is not an attribute
alias = userDN
}
return userDN, alias, nil
}
// dial connects to the LDAP server and authenticates using manager_dn