Module: Gate::Warden
- Defined in:
- lib/gate/warden.rb
Class Method Summary collapse
- .activate_passport_verification(scope: nil, not_if: nil) ⇒ Object
- .activate_rack_augmentation(scope: nil) ⇒ Object
Class Method Details
.activate_passport_verification(scope: nil, not_if: nil) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/gate/warden.rb', line 20 def self.activate_passport_verification(scope: nil, not_if: nil) ::Warden::Manager.after_fetch do |user, warden, | begin if not_if.present? && user.respond_to?(not_if) && user.send(not_if) logger.info { "Warden :after_fetch hook skips PassportVerifier because user instance responds positively to #{not_if.inspect}" } else logger.debug { 'Warden :after_fetch hook delegates to PassportVerifier...' } ::Gate::Warden::PassportVerifier.new(user: user, warden: warden, options: , scope: scope).call end rescue => exception Trouble.notify exception end end end |
.activate_rack_augmentation(scope: nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/gate/warden.rb', line 8 def self.activate_rack_augmentation(scope: nil) ::Warden::Manager.after_fetch do |user, warden, | begin logger.debug { 'Warden :after_fetch hook delegates to RackAugmentor...' } ::Gate::Warden::RackAugmentor.new(user: user, warden: warden, options: , scope: scope).call rescue => exception Trouble.notify exception end end end |