Module: Cas::Authentication::InstanceMethods

Defined in:
lib/bcms_cas/authentication.rb

Overview

Each instance of the controller will gain these methods.

Instance Method Summary collapse

Instance Method Details

#login_from_cas_ticketObject

Attempts to set the current user based on the session attribute set by CAS.



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/bcms_cas/authentication.rb', line 38

def 
  logger.debug "Checking for cas login. The current_user is '#{@current_user.}'." if @current_user
  if session[:cas_user]
    user = CasUser.new(:login=>session[:cas_user])

    # Having to set both of these feels very duplicative. Ideally I would like a way
    #   to set only once, but calling current_user= has side effects.
    @current_user = Cms::User.current = user

    logger.debug "CasUser information found in session. Setting current_user as '#{user.}" if @current_user
  end
  @current_user
end

#verify_cas_configuredObject

Provide a more helpful warning if developers forgot to configure the server correctly.



31
32
33
34
35
# File 'lib/bcms_cas/authentication.rb', line 31

def verify_cas_configured
  unless BcmsCas::Engine.configured?
    BcmsCas::Engine.raise_configuration_error
  end
end