mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-05 23:41:48 +01:00
properly insert CAS as another auth method
This commit is contained in:
parent
31b173ae5b
commit
1621a7bb7d
3 changed files with 31 additions and 4 deletions
|
|
@ -30,7 +30,13 @@ class ApplicationController < ActionController::Base
|
|||
exempt_from_layout /\.js\.erb$/
|
||||
|
||||
if ( SITE_CONFIG['authentication_schemes'].include? 'cas')
|
||||
before_filter CASClient::Frameworks::Rails::Filter
|
||||
# This will allow the user to view the index page without authentication
|
||||
# but will process CAS authentication data if the user already
|
||||
# has an SSO session open.
|
||||
before_filter CASClient::Frameworks::Rails::GatewayFilter, :only => :login
|
||||
|
||||
# This requires the user to be authenticated for viewing allother pages.
|
||||
before_filter CASClient::Frameworks::Rails::Filter, :except => :login
|
||||
end
|
||||
before_filter :set_session_expiration
|
||||
before_filter :set_time_zone
|
||||
|
|
|
|||
|
|
@ -6,11 +6,15 @@ class LoginController < ApplicationController
|
|||
skip_before_filter :login_required
|
||||
before_filter :login_optional
|
||||
before_filter :get_current_user
|
||||
|
||||
|
||||
def login
|
||||
if cas_enabled?
|
||||
@username = session[:cas_user]
|
||||
@login_url = CASClient::Frameworks::Rails::Filter.login_url(self)
|
||||
end
|
||||
if openid_enabled? && using_open_id?
|
||||
login_openid
|
||||
elsif cas_enabled?
|
||||
elsif cas_enabled? && session[:cas_user]
|
||||
login_cas
|
||||
else
|
||||
@page_title = "TRACKS::Login"
|
||||
|
|
@ -136,7 +140,7 @@ class LoginController < ApplicationController
|
|||
end
|
||||
redirect_back_or_home
|
||||
else
|
||||
notify :warning, "Sorry, no user by that identity URL exists (#{identity_url})"
|
||||
notify :warning, "Sorry, no user by that CAS username exists (#{session[:cas_user]})"
|
||||
end
|
||||
else
|
||||
notify :warning, result.message
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue