class Keycard::Authentication::SessionUserId

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.

Public Instance Methods

apply() click to toggle source
# File lib/keycard/authentication/session_user_id.rb, line 12
def apply
  if user_id.nil?
    skipped("No user_id found in session")
  elsif (account = finder.call(user_id))
    succeeded(account, "Account found for user_id '#{user_id}' in session")
  else
    failed("Account not found for user_id '#{user_id}' in session")
  end
end

Private Instance Methods

user_id() click to toggle source
# File lib/keycard/authentication/session_user_id.rb, line 24
def user_id
  session[:user_id]
end