Class: Keycard::Authentication::SessionUserId

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

Overview

Identity verification based on a user_id present in the session.

A user_id in the session would typically be placed there after some other login process, after which it is sufficient to authenticate the session. The finder, then, takes only one parameter, the ID as on the account’s #id property.

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



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

def apply
  if user_id.nil?
    skipped("No user_id found in session")
  elsif ( = finder.call(user_id))
    succeeded(, "Account found for user_id '#{user_id}' in session")
  else
    failed("Account not found for user_id '#{user_id}' in session")
  end
end