Skip to content

Commit

Permalink
refactor: a bit less code
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Nov 1, 2024
1 parent f45d87e commit 00f8af1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ldapauthenticator/ldapauthenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,6 @@ def get_connection(self, userdn, password):
return conn

def get_user_attributes(self, conn, userdn):
attrs = {}
if self.auth_state_attributes:
conn.search(
search_base=userdn,
Expand All @@ -554,13 +553,13 @@ def get_user_attributes(self, conn, userdn):
# identify unique search response entry
n_entries = len(conn.entries)
if n_entries == 1:
attrs = conn.entries[0].entry_attributes_as_dict
return conn.entries[0].entry_attributes_as_dict
else:
self.log.warning(
f"Expected 1 but got {n_entries} search response entries for DN '{userdn}' "
"when looking up attributes configured via auth_state_attributes."
)
return attrs
return {}

async def authenticate(self, handler, data):
"""
Expand Down

0 comments on commit 00f8af1

Please sign in to comment.