Module: JWT::Token::Verifier::ClassMethods

Defined in:
lib/jwt/token/verifier.rb

Instance Method Summary collapse

Instance Method Details

#verify(jwt_token, context = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/jwt/token/verifier.rb', line 12

def verify(jwt_token, context = nil)
  decoded = JWT.decode(jwt_token, nil, true, decode_options) do |header|
    algorithm_type = JWT::Token::Configuration::ALGORITHMS[header["alg"]]
    configuration.send(algorithm_type).public_key if algorithm_type
  end

  new(decoded[0]).tap do |token|
    claims.each do |claim|
      claim.verify(token, context)
    end
  end
end