cschiewek / devise_ldap_authenticatable

Devise Module for LDAP
MIT License
593 stars 359 forks source link

Check if devise_ldap_authenticatable can bind as admin #218

Closed bk322 closed 8 years ago

bk322 commented 8 years ago

Is there a way to check if devise_ldap_authenticatable can bind as admin? I provided all credentials, but the notorious get_ldap_param does not work.

Basically I just used the same dn and password I use with net-ldap. And it works there. But I get:

(byebug) Devise::LDAP::Adapter.get_ldap_param(self.email, "FirstName")
  LDAP: LDAP search for login: mail=email_that_works@ldap.my
  LDAP: LDAP search yielded 0 matches
  LDAP: Requested ldap entry does not exist
nil
bk322 commented 8 years ago

Oh, I found a solution. One has to add

config.ldap_auth_username_builder = Proc.new() {|attribute, login, ldap| "#{login}" }

to config/initializers/device.rb. source