module Seraph::Grape::Helpers

Public Instance Methods

auth_info() click to toggle source
# File lib/seraph/grape/helpers.rb, line 8
def auth_info
  @auth_info ||= Seraph::Grape::JWT.decode(headers['Authorization'])
end
authenticate!() click to toggle source
# File lib/seraph/grape/helpers.rb, line 4
def authenticate!
  unauthorized! if auth_info.nil?
end
sign_in(user, password) click to toggle source
# File lib/seraph/grape/helpers.rb, line 12
def sign_in(user, password)
  result = Seraph::Grape::Authenticator.call(user, password)
  unauthorized! unless result
  result
end
unauthorized!() click to toggle source
# File lib/seraph/grape/helpers.rb, line 18
def unauthorized!
  error!('Unauthorized', 401)
end