adding logging for ldap exceptions
This commit is contained in:
1 parent
69cbfa2d3f
commit
6d20db75c5
2 files changed
+6
-4
No files matched your search
@@ -6,6 +6,8 @@ blocking the event loop. Login builds the user's DN from
|
||||
successful profile is provisioned locally on first sign-in.
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from fastapi.concurrency import run_in_threadpool
|
||||
@@ -40,10 +42,9 @@ def _bind_and_fetch(username: str, password: str) -> LdapIdentity | None:
|
||||
get_info=ldap3.NONE,
|
||||
)
|
||||
try:
|
||||
conn = ldap3.Connection(
|
||||
server, user=user_dn, password=password, auto_bind=True
|
||||
)
|
||||
except LDAPException:
|
||||
conn = ldap3.Connection(server, user=user_dn, password=password, auto_bind=True)
|
||||
except LDAPException as e:
|
||||
logging.exception("Failed to log into LDAP for user %s", user_dn)
|
||||
# Wrong credentials, unreachable server, or a refused bind.
|
||||
return None
|
||||
|
||||
|
||||
Reference in new issue
Block a user