Module: CalnetAuthenticated::Controller

Defined in:
lib/calnet_authenticated/controller.rb

Overview

Further info regarding UCB’s CAS setup can be found at calnet.berkeley.edu/developers/developerResources/cas/CASAppSetup.html#firstLevelServers

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Setup the CASClient and add the cas_filter before_filter to all application_controller requests. This can be overridden or “skipped” in any controller, particularly those that are passive and will use the cas_gateway_filter instead.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/calnet_authenticated/controller.rb', line 13

def self.included(base)
	base_server_url = ( RAILS_ENV == "production" ) ? 
		"https://auth.berkeley.edu" : 
		"https://auth-test.berkeley.edu"

	CASClient::Frameworks::Rails::Filter.configure(
		:username_session_key => :calnetuid,
		:cas_base_url => "#{base_server_url}/cas/"
	)

	base.helper_method :current_user, :logged_in?

	base.extend(ClassMethods)
	base.send(:include, InstanceMethods)

	base.class_eval do
		class << self
			alias_method_chain :inherited, :calnet_before_filter
		end
	end
end