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

Add optional Group membership when authenticating users #37

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add optional Group membership when authenticating users #37

wants to merge 3 commits into from

Conversation

techno1ology
Copy link

I have requirements on my current project to only allow access for users belonging to a specific group. This feature will allow group to be optionally specified in the LDAP Strategy configuration.

@@ -42,6 +43,11 @@ def callback_phase
@ldap_user_info = @adaptor.bind_as(:filter => Net::LDAP::Filter.eq(@adaptor.uid, @options[:name_proc].call(request['username'])),:size => 1, :password => request['password'])
return fail!(:invalid_credentials) if !@ldap_user_info

# If group is specified in options, validate membership
if @options[:group]

Choose a reason for hiding this comment

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

Recommend moving this check into the is_member function. That is, is_member should return true if @options[:group] has not been set. This prevents anyone else that might use is_member from needing to understand that it has a precondition of @options[:group] having been set, this precondition is unneeded.

@pyu10055
Copy link
Collaborator

newly merged filter option should allow you to add group restriction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants