limit login record entries

Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
hongming
2021-03-04 17:44:00 +08:00
parent 65f935d0df
commit 70a0ee40d6
18 changed files with 250 additions and 716 deletions

View File

@@ -126,7 +126,10 @@ func (l ldapProvider) Authenticate(username string, password string) (identitypr
return nil, err
}
filter := fmt.Sprintf("(&(%s=%s)%s)", l.LoginAttribute, username, l.UserSearchFilter)
filter := fmt.Sprintf("(%s=%s)", l.LoginAttribute, ldap.EscapeFilter(username))
if l.UserSearchFilter != "" {
filter = fmt.Sprintf("(&%s%s)", filter, l.UserSearchFilter)
}
result, err := conn.Search(&ldap.SearchRequest{
BaseDN: l.UserSearchBase,
Scope: ldap.ScopeWholeSubtree,