Class: Booth::Hooks::AfterFetch

Inherits:
Object
  • Object
show all
Includes:
Logging, Calls
Defined in:
lib/booth/hooks/after_fetch.rb

Overview

Once Warden fetched the session from DB, let’s check it for authorization.

Instance Method Summary collapse

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/booth/hooks/after_fetch.rb', line 14

def call
  if passport.blocked
    log { 'Your credential is blocked. Logging you out.' }
    request.authentication.logout

  elsif passport.revoked
    log { "Your session in scope #{scope.inspect} was revoked. Logging you out." }
    request.authentication.logout

  else
    log { "Registering activity of legitimate session in scope #{scope.inspect} with IP #{request.ip}..." }
    register_activity
  end

  nil
end