Skip to content

Commit

Permalink
Tweak log messages further, make users actionable
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Nov 1, 2024
1 parent 0732444 commit 70ea3cd
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ldapauthenticator/ldapauthenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,16 +477,17 @@ def resolve_username(self, username_supplied_by_user):
self.lookup_dn_user_dn_attribute
)
if not attribute_values:
self.log.warning(
f"Failed to lookup attribute '{self.lookup_dn_user_dn_attribute}' "
f"for username '{username_supplied_by_user}'"
self.log.error(
f"Login of '{username_supplied_by_user}' denied, failed to lookup attribute "
f"'{self.lookup_dn_user_dn_attribute}'. Is lookup_dn_user_dn_attribute "
"configured correctly?"
)
return (None, None)
if len(attribute_values) > 1:
self.log.error(
f"A lookup of the username '{username_supplied_by_user}' returned multiple "
f"values for the attribute '{self.lookup_dn_user_dn_attribute}': "
f"({', '.join(attribute_values)})"
f"Login of '{username_supplied_by_user}' denied, lookup of attribute "
f"'{self.lookup_dn_user_dn_attribute}' gave multiple values but only "
"one is expected. Is lookup_dn_user_dn_attribute configured correctly?"
)
return None, None

Expand Down

0 comments on commit 70ea3cd

Please sign in to comment.