Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: specify param names for Connection.search consistently #268

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ldapauthenticator/ldapauthenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,10 @@ def get_user_attributes(self, conn, userdn):
attrs = {}
if self.auth_state_attributes:
found = conn.search(
userdn, "(objectClass=*)", attributes=self.auth_state_attributes
search_base=userdn,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understanding that this param was search_base helped me understand things better.

search_scope=ldap3.SUBTREE,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUBTREE is the default value, specified explicitly as it were other places.

search_filter="(objectClass=*)",
attributes=self.auth_state_attributes,
)
if found:
attrs = conn.entries[0].entry_attributes_as_dict
Expand Down Expand Up @@ -506,7 +509,7 @@ async def authenticate(self, handler, data):
found = False
for group in self.allowed_groups:
found = conn.search(
group,
search_base=group,
search_scope=ldap3.BASE,
search_filter=self.group_search_filter.format(
userdn=escape_filter_chars(userdn),
Expand Down
Loading