Allow login of simpleSecurityObjects
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
5643713c54
commit
e5046b108b
5 changed files with 28 additions and 10 deletions
9
ldap.go
9
ldap.go
|
|
@ -65,11 +65,16 @@ func (l LDAPConn) Bind(username string, password string) error {
|
|||
return l.connection.Bind(username, password)
|
||||
}
|
||||
|
||||
func (l LDAPConn) SearchDN(username string) (string, error) {
|
||||
func (l LDAPConn) SearchDN(username string, person bool) (string, error) {
|
||||
objectClass := "organizationalPerson"
|
||||
if !person {
|
||||
objectClass = "simpleSecurityObject"
|
||||
}
|
||||
|
||||
searchRequest := ldap.NewSearchRequest(
|
||||
l.BaseDN,
|
||||
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
|
||||
fmt.Sprintf("(&(objectClass=organizationalPerson)(uid=%s))", username),
|
||||
fmt.Sprintf("(&(objectClass=%s)(uid=%s))", objectClass, username),
|
||||
[]string{"dn"},
|
||||
nil,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue