class Auth0::Verifier::Handlers::Rs256

Public Instance Methods

verify() click to toggle source
# File lib/auth0/verifier/handlers/rs256.rb, line 9
def verify
  decode_jwt do |header|
    jwks.keys[header['kid']]
  end
rescue ::JWT::DecodeError, ::JWT::VerificationError
  raise Auth0::Verifier::Error, 'Cannot verify token'
end

Private Instance Methods

decode_jwt(&block) click to toggle source
# File lib/auth0/verifier/handlers/rs256.rb, line 19
def decode_jwt(&block)
  ::JWT.decode(
    token,
    nil,
    true, # Verify the signature of this token
    jwt_options,
    &block
  )
end
jwks() click to toggle source
# File lib/auth0/verifier/handlers/rs256.rb, line 39
def jwks
  @jwks ||= Auth0::Verifier::Jwks.new(config.jwks_url)
end
jwt_options() click to toggle source
# File lib/auth0/verifier/handlers/rs256.rb, line 29
def jwt_options
  {
    algorithm: 'RS256',
    iss: "#{config.url}/",
    verify_iss: true,
    aud: config.audience,
    verify_aud: true
  }
end