This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
2021-04-19 22:30:27 +00:00
|
|
|
package ldap
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
|
|
|
|
"github.com/nmcclain/ldap"
|
|
|
|
)
|
|
|
|
|
2021-04-25 20:07:12 +00:00
|
|
|
type UIDResponse struct {
|
|
|
|
UIDFIeld string `json:"uid_field"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type PasswordResponse struct {
|
|
|
|
Password string `json:"password"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ls *LDAPServer) Bind(bindDN string, bindPW string, conn net.Conn) (ldap.LDAPResultCode, error) {
|
2021-04-26 09:53:06 +00:00
|
|
|
for _, instance := range ls.providers {
|
|
|
|
username, err := instance.getUsername(bindDN)
|
|
|
|
if err == nil {
|
|
|
|
return instance.Bind(username, bindPW, conn)
|
2021-04-25 20:07:12 +00:00
|
|
|
}
|
|
|
|
}
|
2021-04-26 09:53:06 +00:00
|
|
|
ls.log.WithField("dn", bindDN).WithField("request", "bind").Warning("No provider found for request")
|
|
|
|
return ldap.LDAPResultOperationsError, nil
|
2021-04-19 22:30:27 +00:00
|
|
|
}
|