module AzureJwtAuth::Authenticable

Public Instance Methods

authenticate!() click to toggle source
# File lib/azure_jwt_auth/authenticable.rb, line 15
def authenticate!
  unauthorize! unless JwtManager.providers

  JwtManager.providers.each do |_uid, provider|
    token = JwtManager.new(request, provider.uid)

    if token.valid?
      @current_user = entity_from_token_payload(token.payload)
      break
    end
  rescue => error
    Rails.logger.info(error) if defined? Rails
  end

  unauthorize! unless @current_user
end
current_user() click to toggle source
# File lib/azure_jwt_auth/authenticable.rb, line 7
def current_user
  @current_user
end
signed_in?() click to toggle source
# File lib/azure_jwt_auth/authenticable.rb, line 11
def signed_in?
  !current_user.nil?
end
unauthorize!() click to toggle source
# File lib/azure_jwt_auth/authenticable.rb, line 32
def unauthorize!
  raise NotAuthorized
end