Sha256: 9f707a8c7d4ab0896aba765d38ef0d5d1db1360a45b0119b74a6ab20b32a3e12
Contents?: true
Size: 1.01 KB
Versions: 10
Compression:
Stored size: 1.01 KB
Contents
require 'chaltron/ldap/user' module Chaltron class OmniauthCallbacksController < Devise::OmniauthCallbacksController default_log_category :login def ldap # puts '##########################################' # puts oauth.inspect # puts '##########################################' # We only find ourselves here # if the authentication to LDAP was successful. user = Chaltron::LDAP::User.find_or_create(oauth, Chaltron.ldap_allow_all) user = Chaltron.ldap_after_authenticate.call(user, Chaltron::LDAP::Connection.new) if user.nil? redirect_to root_url, alert: I18n.t('chaltron.not_allowed_to_sign_in') else user.remember_me = params[:remember_me] if user.persisted? flash[:notice] = I18n.t('devise.sessions.signed_in') info I18n.t('chaltron.logs.login_via', user: user.display_name, provider: 'ldap') sign_in_and_redirect(user) end end private def oauth @oauth ||= request.env['omniauth.auth'] end end end
Version data entries
10 entries across 10 versions & 1 rubygems