debug: add detailed LDAP authentication logging with error traceback
This commit is contained in:
@@ -23,10 +23,13 @@ def get_ldap_config():
|
||||
def authenticate_ldap(username, password):
|
||||
config = get_ldap_config()
|
||||
if not config.get("ldap_enabled"):
|
||||
log.debug("LDAP: LDAP is disabled in config")
|
||||
return None
|
||||
|
||||
|
||||
log.debug(f"LDAP: Config loaded: server_uri={config.get('server_uri')}, base_dn={config.get('base_dn')}")
|
||||
try:
|
||||
server = ldap3.Server(config["server_uri"], use_ssl=config.get("use_tls", False), get_info=ldap3.ALL)
|
||||
log.debug(f"LDAP: Server object created: {config['server_uri']}")
|
||||
user_dn = config["user_template"].format(username=username)
|
||||
log.debug(f"LDAP: Attempting bind for DN: {user_dn}")
|
||||
|
||||
@@ -91,7 +94,9 @@ def authenticate_ldap(username, password):
|
||||
|
||||
return assigned_role
|
||||
except Exception as e:
|
||||
log.debug(f"LDAP: Auth Error: {str(e)}")
|
||||
log.error(f"LDAP: Auth Error: {type(e).__name__}: {str(e)}")
|
||||
import traceback
|
||||
log.debug(f"LDAP: Full traceback: {traceback.format_exc()}")
|
||||
return None
|
||||
pwd_context = CryptContext(schemes=["pbkdf2_sha256"], deprecated="auto")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user