From db54047d044a90e610664cc34f0f201f7ecf47ca Mon Sep 17 00:00:00 2001 From: Sebastian Rust Date: Sat, 2 Jul 2022 16:21:54 +0200 Subject: [PATCH] changed back to python-ldap3 --- radicale3_auth_ldap/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/radicale3_auth_ldap/__init__.py b/radicale3_auth_ldap/__init__.py index d4b94b2..602c497 100644 --- a/radicale3_auth_ldap/__init__.py +++ b/radicale3_auth_ldap/__init__.py @@ -75,12 +75,21 @@ class Auth(BaseAuth): SCOPE = self.configuration.get("auth", "ldap_scope") 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: conn = ldap3.Connection(SERVER, BINDDN, PASSWORD) else: conn = ldap3.Connection(SERVER) conn.bind() + + try: logger.debug("LDAP whoami: %s" % conn.extend.standard.who_am_i()) except Exception as err: