2bb2dee057
This helps with compatibility with more LDAP providers as the implementation doesn't depend on the exact names of the LDAP fields. The LDAP strategy helps maps the attributes to the fields in the info object and we use the info object to get the email and name. This makes the LDAP auth compatible with most OpenLDAP servers as well.
14 lines
360 B
Ruby
14 lines
360 B
Ruby
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|
|
|
def ldap
|
|
# We only find ourselves here if the authentication to LDAP was successful.
|
|
info = request.env["omniauth.auth"]["info"]
|
|
@user = User.find_for_ldap_auth(info)
|
|
if @user.persisted?
|
|
@user.remember_me = true
|
|
end
|
|
sign_in_and_redirect @user
|
|
end
|
|
|
|
end
|