-
Notifications
You must be signed in to change notification settings - Fork 132
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
Add Active Directory LDAP Auth support #697
Merged
+75
−5
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This search should not be performed if both ro_group and rw_group are empty. That would make it possible to use empty values for ro_group and rw_group to provide everyone with read/write access if you don't have the memberOf attribute in your LDAP instance.
Currently, the search_s call would raise an NO_SUCH_ATTRIBUTE exception, meaning all authenticated users would get read only access instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I follow, that's exactly what is intended, if both ro_group and rw_group is empty, no group member security is used, and everyone will always get read/write access no matter if memberOf is present or not.
When I was testing I did not get NO_SUCH_ATTRIBUTE from the search_s if the memberOf attribute was missing, however I do get KeyError on 'if self._ldap_ro_group in res[0][1]['memberOf']:'
But sure, we can do a separate search for memberOf only if at least one of ro_group or rw_group is non empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind then. From a cursory look at the python-ldap it seemed like it would raise the NO_SUCH_ATTRIBUTE exception when you request an attribute that doesn't exist, but since it doesn't, it doesn't matter. I also overlooked that the search result was used to get the name of the user, so it seemed as if the result wasn't used at all if groups weren't non-empty.
Just disregard my previous comment - doing just one search is fine.
Adding a specific except clause for the KeyError, that raises an appropriate exception would probably be a good idea though (since it indicates misconfiguration).