3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# 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"
Rails.logger.warn "User from CAS with netid #{access_token&.uid} was not found. Provider: cas"
redirect_to help_path
flash.notice = "You can not be signed in at this time."
elsif @user.nil?
Rails.logger.warn "User from CAS with netid #{access_token&.uid} was not found. Provider: #{access_token&.provider}"
redirect_to root_path
flash.alert = "You are not a recognized CAS user."
else
sign_in_and_redirect @user, event: :authentication end
end
|