module AppRail::Airtable::AuthenticationHelpers

Public Instance Methods

authenticate!() click to toggle source
# File lib/app_rail/airtable/authentication_helpers.rb, line 22
def authenticate!
  halt 401 unless current_user
end
authorization_header() click to toggle source
# File lib/app_rail/airtable/authentication_helpers.rb, line 18
def authorization_header
  request.env["HTTP_AUTHORIZATION"]
end
bearer_token() click to toggle source
# File lib/app_rail/airtable/authentication_helpers.rb, line 12
def bearer_token
  authorization_values = authorization_header.split(" ")
  return nil unless authorization_values.count > 1
  authorization_values[1]
end
current_user() click to toggle source
# File lib/app_rail/airtable/authentication_helpers.rb, line 4
def current_user
  @current_user ||= find_current_user
end
find_current_user() click to toggle source
# File lib/app_rail/airtable/authentication_helpers.rb, line 8
def find_current_user
  authorization_header && bearer_token ? find_authenticatable_resource(access_token: bearer_token) : nil
end