mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-07-09 03:30:18 +00:00
feat: try anonymous bind when bind credentials are empty (#979)
This commit is contained in:
@@ -246,6 +246,12 @@ func (ldap *LdapService) BindService(rebind bool) error {
|
||||
if ldap.cert != nil {
|
||||
return ldap.conn.ExternalBind()
|
||||
}
|
||||
|
||||
// attempt unauthenticated/anonymous bind if both BindDN and bindpw are unset
|
||||
if ldap.config.LDAP.BindDN == "" && ldap.bindPw == "" {
|
||||
return ldap.conn.UnauthenticatedBind("")
|
||||
}
|
||||
|
||||
return ldap.conn.Bind(ldap.config.LDAP.BindDN, ldap.bindPw)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user