Class: ConcertoShibAuth::OmniauthCallbackController

Inherits:
ApplicationController show all
Defined in:
app/controllers/concerto_shib_auth/omniauth_callback_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#find_from_omniauth

Instance Method Details

#shib_authObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/concerto_shib_auth/omniauth_callback_controller.rb', line 6

def shib_auth
  shib_hash = request.env["omniauth.auth"]
  user = find_from_omniauth(shib_hash)

  if !user
    # Redirect showing flash notice with errors
    redirect_to "/"
  elsif user.persisted?
    flash.notice = "Signed in through Shibboleth"
    session["devise.user_attributes"] = user.attributes
     user
    redirect_to "/"
  else 
    flash.notice = "Signed in through Shibboleth"
    session["devise.user_attributes"] = user.attributes
     user
    redirect_to "/"
  end
end