Open ghost opened 9 years ago
I access devise's Net::LDAP-object:
ldap_connection = Devise::LDAP::Adapter.ldap_connect(nil).ldap # I'm using 'config.ldap_use_admin_to_bind = true' in devise.rb
resultset = ldap_connection
.search(base: 'dc=foo, dc=lan'...
It will use devise's config to establish a connection to the ldap server automatically.
Hope that helps...
It would be beneficial if the ldap connection
Devise::LDAP::Connection
were made available in theafter_ldap_authentication
callback. Or, if a new callback were created which made the connection available.For example, immediately after an LDAP user is authenticated, I want to save their photo. Something like this:
Currently, I cannot do this without pulling in
Net::LDAP
and re-authenticating/binding with the login and password. If there were a callback which provided access to the ldap connection, I could just use it.I looked at the source superficially, and the call to the callback in strategy.rb#L20 would have to change (among other things) to pass in the connection.