Class: Keycard::Authentication::AuthToken

Inherits:
Method
  • Object
show all
Defined in:
lib/keycard/authentication/auth_token.rb

Overview

Identity verification based on an authorization token.

The bound finder method is expected to take one parameter, the token as presented by the user. This will typically need to be digested for comparison with a stored version.

Instance Method Summary collapse

Methods inherited from Method

bind, bind_class_method, #initialize

Constructor Details

This class inherits a constructor from Keycard::Authentication::Method

Instance Method Details

#applyObject



11
12
13
14
15
16
17
18
19
# File 'lib/keycard/authentication/auth_token.rb', line 11

def apply
  if token.nil?
    skipped("No auth_token found in request attributes")
  elsif ( = finder.call(token))
    succeeded(, "Account found for supplied Authorization Token", csrf_safe: true)
  else
    failed("Account not found for supplied Authorization Token")
  end
end