[BUGFIX] Allow username_attribute == mail_attribute (#865)

pull/871/head
Sohalt 2020-04-15 14:26:23 +02:00 committed by GitHub
parent 4d1c2f38be
commit 4deebe2a64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -162,7 +162,8 @@ func (p *LDAPUserProvider) getUserProfile(conn LDAPConnection, inputUsername str
for _, attr := range sr.Entries[0].Attributes {
if attr.Name == p.configuration.MailAttribute {
userProfile.Emails = attr.Values
} else if attr.Name == p.configuration.UsernameAttribute {
}
if attr.Name == p.configuration.UsernameAttribute {
if len(attr.Values) != 1 {
return nil, fmt.Errorf("User %s cannot have multiple value for attribute %s",
inputUsername, p.configuration.UsernameAttribute)