Skip to content

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