Class: Sso::Warden::Hooks::BeforeLogout
- Inherits:
-
Object
- Object
- Sso::Warden::Hooks::BeforeLogout
- Includes:
- Logging
- Defined in:
- lib/sso/warden/hooks/before_logout.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#warden ⇒ Object
readonly
Returns the value of attribute warden.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(user, warden, options) ⇒ BeforeLogout
constructor
A new instance of BeforeLogout.
- #logged_in? ⇒ Boolean
- #scope ⇒ Object
- #session ⇒ Object
Methods included from Logging
#debug, #error, #fatal, #info, #warn
Constructor Details
#initialize(user, warden, options) ⇒ BeforeLogout
Returns a new instance of BeforeLogout.
17 18 19 |
# File 'lib/sso/warden/hooks/before_logout.rb', line 17 def initialize(user, warden, ) @user, @warden, = user, warden, end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/sso/warden/hooks/before_logout.rb', line 7 def end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
7 8 9 |
# File 'lib/sso/warden/hooks/before_logout.rb', line 7 def user @user end |
#warden ⇒ Object (readonly)
Returns the value of attribute warden.
7 8 9 |
# File 'lib/sso/warden/hooks/before_logout.rb', line 7 def warden @warden end |
Class Method Details
.to_proc ⇒ Object
11 12 13 14 15 |
# File 'lib/sso/warden/hooks/before_logout.rb', line 11 def self.to_proc proc do |user, warden, | new(user, warden, ).call end end |
Instance Method Details
#call ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/sso/warden/hooks/before_logout.rb', line 21 def call # Only run if user is logged in if logged_in? debug { "#BeforeLogout Sso::Session - #{session["sso_session_id"]}" } debug { "user is #{user.inspect}" } ::Sso::Session.logout(session["sso_session_id"]) end end |
#logged_in? ⇒ Boolean
38 39 40 |
# File 'lib/sso/warden/hooks/before_logout.rb', line 38 def logged_in? warden.authenticated?(scope) && session && user end |
#scope ⇒ Object
30 31 32 |
# File 'lib/sso/warden/hooks/before_logout.rb', line 30 def scope scope = [:scope] end |
#session ⇒ Object
34 35 36 |
# File 'lib/sso/warden/hooks/before_logout.rb', line 34 def session warden.session(scope) end |