module Foyer::API::Helpers

Protected Instance Methods

authenticate_user!() click to toggle source
# File lib/foyer/api/helpers.rb, line 17
def authenticate_user!
  head :unauthorized unless user_signed_in?
end
current_user() click to toggle source
# File lib/foyer/api/helpers.rb, line 12
def current_user
  return nil unless request.authorization.to_s =~ /^Bearer (.*)/m
  @current_user ||= Foyer.token_finder.call(Regexp.last_match[1])
end
user_signed_in?() click to toggle source
# File lib/foyer/api/helpers.rb, line 8
def user_signed_in?
  current_user.present?
end