Class: CasAuthentication
- Inherits:
-
Object
- Object
- CasAuthentication
- Defined in:
- lib/components/cas_authentication.rb
Overview
Authenticate User and Create Session
Instance Method Summary collapse
-
#initialize(session) ⇒ CasAuthentication
constructor
A new instance of CasAuthentication.
- #perform ⇒ Object
- #user ⇒ Object
Constructor Details
#initialize(session) ⇒ CasAuthentication
Returns a new instance of CasAuthentication.
4 5 6 |
# File 'lib/components/cas_authentication.rb', line 4 def initialize(session) @session = session end |
Instance Method Details
#perform ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/components/cas_authentication.rb', line 13 def perform return true if authenticated? return unless session['cas'].present? if new_user? authenticate! if create_user! elsif unauthenticated? authenticate! update_extra_attributes! end end |
#user ⇒ Object
8 9 10 11 |
# File 'lib/components/cas_authentication.rb', line 8 def user return unless username.present? @user ||= User.find_or_initialize_by(username: username) end |