mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-10-29 13:15:46 +00:00
feat: add configurable search filter
This commit is contained in:
@@ -41,7 +41,7 @@ func (l *LDAP) Search(username string) (string, error) {
|
||||
searchRequest := ldapgo.NewSearchRequest(
|
||||
l.BaseDN,
|
||||
ldapgo.ScopeWholeSubtree, ldapgo.NeverDerefAliases, 0, 0, false,
|
||||
fmt.Sprintf("(uid=%s)", username),
|
||||
fmt.Sprintf(l.Config.SearchFilter, username),
|
||||
[]string{"dn"},
|
||||
nil,
|
||||
)
|
||||
|
||||
@@ -41,6 +41,7 @@ type Config struct {
|
||||
LdapBindPassword string `mapstructure:"ldap-bind-password"`
|
||||
LdapBaseDN string `mapstructure:"ldap-base-dn"`
|
||||
LdapInsecure bool `mapstructure:"ldap-insecure"`
|
||||
LdapSearchFilter string `mapstructure:"ldap-search-filter"`
|
||||
}
|
||||
|
||||
// Server configuration
|
||||
@@ -135,4 +136,5 @@ type LdapConfig struct {
|
||||
BindPassword string
|
||||
BaseDN string
|
||||
Insecure bool
|
||||
SearchFilter string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user