module EasyJwtAuth::RailsHelper

Public Instance Methods

jwt_authenticate!() click to toggle source
# File lib/easy_jwt_auth/rails_helper.rb, line 12
def jwt_authenticate!
  head(403) if jwt_current_user.nil?
end
jwt_current_user() click to toggle source
# File lib/easy_jwt_auth/rails_helper.rb, line 3
def jwt_current_user
  return @_jwt_current_user if defined?(@_jwt_current_user)

  auth_header = request.headers['Authorization']
  @_jwt_current_user = EasyJwtAuth::UserFinder.new.user_from_header(auth_header)
rescue StandardError => e
  nil
end