changed back to python-ldap3

This commit is contained in:
Sebastian Rust
2022-07-02 16:21:54 +02:00
parent 5ca21d4f46
commit db54047d04

View File

@@ -75,12 +75,21 @@ class Auth(BaseAuth):
SCOPE = self.configuration.get("auth", "ldap_scope") SCOPE = self.configuration.get("auth", "ldap_scope")
SUPPORT_EXTENDED = self.configuration.get("auth", "ldap_support_extended") SUPPORT_EXTENDED = self.configuration.get("auth", "ldap_support_extended")
try:
conn = Connection(server, f'cn={user},ou=users,DC=ldap,DC=goauthentik,DC=io', password, client_strategy=SAFE_SYNC, auto_bind=True)
return user
except Exception as err:
logger.debug("LDAP error: %s" % err)
return ""
if BINDDN and PASSWORD: if BINDDN and PASSWORD:
conn = ldap3.Connection(SERVER, BINDDN, PASSWORD) conn = ldap3.Connection(SERVER, BINDDN, PASSWORD)
else: else:
conn = ldap3.Connection(SERVER) conn = ldap3.Connection(SERVER)
conn.bind() conn.bind()
try: try:
logger.debug("LDAP whoami: %s" % conn.extend.standard.who_am_i()) logger.debug("LDAP whoami: %s" % conn.extend.standard.who_am_i())
except Exception as err: except Exception as err: