Class: Users::OmniauthCallbacksController

Inherits:
Devise::OmniauthCallbacksController
  • Object
show all
Defined in:
app/controllers/users/omniauth_callbacks_controller.rb

Instance Method Summary collapse

Instance Method Details

#casObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/users/omniauth_callbacks_controller.rb', line 3

def cas
  access_token = request.env["omniauth.auth"]
  @user = User.from_cas(access_token)

  set_cas_session

  if @user.nil? && access_token&.provider == "cas"
    redirect_to help_path
    flash.notice = "You can not be signed in at this time."
  elsif @user.nil?
    redirect_to root_path
    flash.alert = "You are not a recognized CAS user."
  else
     @user, event: :authentication # this will throw if @user is not activated
  end
end