Module: Authlogic::Cas
- Defined in:
- lib/authlogic_cas.rb,
lib/authlogic_cas/engine.rb,
lib/authlogic_cas/single_sign_out/cache.rb,
lib/authlogic_cas/controller_actions/service.rb,
lib/authlogic_cas/controller_actions/session.rb,
app/controllers/authlogic/cas/cas_client_controller.rb,
app/controllers/authlogic/cas/cas_authentication_controller.rb
Defined Under Namespace
Modules: ControllerActions, SingleSignOut Classes: CasAuthenticationController, CasClientController, Engine
Constant Summary collapse
- @@cas_base_url =
"https://cloudfuji.com/cas"
- @@cas_login_url =
The login URL of the CAS server. If undefined, will default based on cas_base_url.
nil
- @@cas_logout_url =
The login URL of the CAS server. If undefined, will default based on cas_base_url.
nil
- @@cas_validate_url =
The login URL of the CAS server. If undefined, will default based on cas_base_url.
nil
- @@cas_enable_single_sign_out =
Should devise_cas_authenticatable enable single-sign-out? Requires use of a supported session_store. Currently supports active_record or redis. False by default.
true
- @@cas_create_user =
Should devise_cas_authenticatable attempt to create new user records for unknown usernames? True by default.
true
- @@cas_username_column =
The model attribute used for query conditions. Should be the same as the rubycas-server username_column. :username by default
:ido_id
- @@cas_destination_logout_param_name =
Name of the parameter passed in the logout query
nil
Class Method Summary collapse
- .cas_client ⇒ Object
- .cas_create_user? ⇒ Boolean
- .define_authentication_method_for(model) ⇒ Object
- .setup_authentication ⇒ Object
Class Method Details
.cas_client ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/authlogic_cas.rb', line 56 def cas_client @@cas_client ||= ::CASClient::Client.new( :cas_destination_logout_param_name => @@cas_destination_logout_param_name, :cas_base_url => @@cas_base_url, :login_url => @@cas_login_url, :logout_url => @@cas_logout_url, :validate_url => @@cas_validate_url, :enable_single_sign_out => @@cas_enable_single_sign_out ) end |
.cas_create_user? ⇒ Boolean
98 99 100 |
# File 'lib/authlogic_cas.rb', line 98 def cas_create_user? cas_create_user end |
.define_authentication_method_for(model) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/authlogic_cas.rb', line 73 def define_authentication_method_for(model) model.instance_eval do define_singleton_method :authenticate_with_cas_ticket do |ticket| ::Authlogic::Cas.cas_client.validate_service_ticket(ticket) unless ticket.has_been_validated? return nil if not ticket.is_valid? conditions = {::Authlogic::Cas.cas_username_column => ticket.respond_to?(:user) ? ticket.user : ticket.response.user} resource = find(:first, :conditions => conditions) resource = new(conditions.merge({:persistence_token => ::Authlogic::Random.hex_token})) if (resource.nil? and ::Authlogic::Cas.cas_create_user?) return nil if not resource if resource.respond_to? :cloudfuji_extra_attributes extra_attributes = ticket.respond_to?(:extra_attributes) ? ticket.extra_attributes : ticket.response.extra_attributes resource.cloudfuji_extra_attributes(extra_attributes) end resource.save resource end end end |