Class: SSO::Server::Warden::Hooks::BeforeLogout

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/sso/server/warden/hooks/before_logout.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logging

#debug, #error, #fatal, #info, #logger, #progname, #warn

Constructor Details

#initialize(user:, warden:, options:) ⇒ BeforeLogout

Returns a new instance of BeforeLogout.



24
25
26
# File 'lib/sso/server/warden/hooks/before_logout.rb', line 24

def initialize(user:, warden:, options:)
  @user, @warden, @options = user, warden, options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/sso/server/warden/hooks/before_logout.rb', line 8

def options
  @options
end

#userObject (readonly)

Returns the value of attribute user.



8
9
10
# File 'lib/sso/server/warden/hooks/before_logout.rb', line 8

def user
  @user
end

#wardenObject (readonly)

Returns the value of attribute warden.



8
9
10
# File 'lib/sso/server/warden/hooks/before_logout.rb', line 8

def warden
  @warden
end

Class Method Details

.to_procObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/sso/server/warden/hooks/before_logout.rb', line 13

def self.to_proc
  proc do |user, warden, options|
    begin
      new(user: user, warden: warden, options: options).call
    rescue => exception
      ::SSO.config.exception_handler.call exception
      nil
    end
  end
end

Instance Method Details

#callObject



28
29
30
31
32
33
34
35
# File 'lib/sso/server/warden/hooks/before_logout.rb', line 28

def call
  debug { 'Before warden destroys the passport in the cookie, it will revoke all connected Passports as well.' }
  revoking = Passports.logout passport_id: params['passport_id']

  error { 'Could not revoke the Passports.' } if revoking.failure?
  debug { 'Finished.' }
  nil
end