Class: Macros::Auth::SignOutAllScopes
- Defined in:
- lib/macros/auth/sign_out_all_scopes.rb
Overview
Sign out users of all scopes
Instance Method Summary collapse
-
#call(ctx) ⇒ Object
Performs a step by sign out users.
-
#initialize(except: []) ⇒ Macros::Auth::SignOutAllScopes
constructor
Step macro instance.
Methods inherited from Base
Constructor Details
#initialize(except: []) ⇒ Macros::Auth::SignOutAllScopes
Returns step macro instance.
15 16 17 |
# File 'lib/macros/auth/sign_out_all_scopes.rb', line 15 def initialize(except: []) @except = except.is_a?(Array) ? except : [except] end |
Instance Method Details
#call(ctx) ⇒ Object
Performs a step by sign out users
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/macros/auth/sign_out_all_scopes.rb', line 21 def call(ctx, **) warden = ctx[:warden] if @except.empty? warden.logout else (Devise.mappings.keys - @except).each do |scope| warden.logout(scope) if warden.authenticated?(scope: scope) end end Macros::Auth::ExpireSessionData.new.call(ctx) warden.clear_strategies_cache! warden.lock! end |