mirror of
https://codeberg.org/shroff/phylum.git
synced 2026-01-22 03:59:34 -06:00
[server][auth][ldap] Fix search filter
This commit is contained in:
@@ -63,7 +63,7 @@ func NewAuth(cfg Config, log zerolog.Logger) (*Auth, error) {
|
||||
return nil, errors.New("filter template not set")
|
||||
}
|
||||
info = info.Str("base_dn", cfg.Search.BaseDN)
|
||||
info = info.Str("filter_template", cfg.DNTemplate)
|
||||
info = info.Str("filter_template", cfg.Search.FilterTemplate)
|
||||
} else {
|
||||
info = info.Str("dn_template", cfg.DNTemplate)
|
||||
}
|
||||
@@ -141,14 +141,12 @@ func (a *Auth) VerifyUserPassword(_ db.Handler, email, password string) (bool, e
|
||||
if a.dnTemplate != "" {
|
||||
userDN = strings.ReplaceAll(a.dnTemplate, "{email}", email)
|
||||
} else {
|
||||
if b, err := a.conn.SimpleBind(&ldap.SimpleBindRequest{
|
||||
if _, err := a.conn.SimpleBind(&ldap.SimpleBindRequest{
|
||||
Username: a.search.BindDN,
|
||||
Password: a.search.BindPassword,
|
||||
AllowEmptyPassword: true,
|
||||
}); err != nil {
|
||||
return false, err
|
||||
} else {
|
||||
fmt.Printf("%+v", b)
|
||||
}
|
||||
|
||||
req := ldap.NewSearchRequest(
|
||||
|
||||
@@ -17,6 +17,8 @@ core:
|
||||
permission: 0x10 # Invite users
|
||||
|
||||
auth:
|
||||
auto_create:
|
||||
- "@example.com"
|
||||
password:
|
||||
backend: crypt
|
||||
crypt:
|
||||
@@ -39,12 +41,12 @@ auth:
|
||||
starttls: false
|
||||
connect_timeout: 30s
|
||||
request_timeout: 30s
|
||||
dn_template: cn={email},ou=people,dc=example,dc=com
|
||||
dn_template:
|
||||
search:
|
||||
bind_dn: cn=phylum,ou=people,dc=example,dc=com
|
||||
bind_dn:
|
||||
bind_password:
|
||||
base_dn: dc=example,dc=com
|
||||
filter_template: (&(objectclass=person)(mail={email}))
|
||||
base_dn:
|
||||
filter_template:
|
||||
|
||||
|
||||
jobs:
|
||||
|
||||
Reference in New Issue
Block a user