Skip to content

Commit

Permalink
Improve logging when failing unique search_filter match
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Sep 19, 2024
1 parent e7180c9 commit 2298356
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ldapauthenticator/ldapauthenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,13 +521,15 @@ async def authenticate(self, handler, data):
n_users = len(conn.response)
if n_users == 0:
self.log.warning(
f"User with '{self.user_attribute}={username}' not found in directory"
"Configured search_filter found no user associated with "
f"userattr='{self.user_attribute}' and username='{username}'"
)
return None
if n_users > 1:
self.log.warning(
"Duplicate users found! {n_users} users found "
f"with '{self.user_attribute}={username}'"
"Configured search_filter found multiple users associated with "
f"userattr='{self.user_attribute}' and username='{username}', a "
"unique match is required."
)
return None

Expand Down

0 comments on commit 2298356

Please sign in to comment.