rubycas / rubycas-server

Provides single sign-on authentication for web applications, implementing the server-end of Jasig's CAS protocol.
http://rubycas.github.com
Other
628 stars 270 forks source link

LDAP extra_attributes (memberof not returning fix) #173

Open aurelienduarte opened 11 years ago

aurelienduarte commented 11 years ago

Due to the fact that memberof is not an actual attribute, it has to be explicitly requested as an attribute in the searchRequest to be returned, this can be addressed by explicitly defining that the extra_attributes are returned on the search request as follows:

def find_user
  results= if @options[:extra_attributes]
            @ldap.search(:base => options[:ldap][:base], :filter => user_filter,
                         :attributes => @options[:extra_attributes].gsub(/ */, '').split(','))
          else
            @ldap.search(:base => options[:ldap][:base], :filter => user_filter)
          end
  return results.first
end

A side effect of this change is an optimised/lighter search.