File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ def decode_segments
2424 validate_segment_count!
2525 if @verify
2626 decode_crypto
27+ verify_algo
2728 verify_signature
2829 verify_claims
2930 end
@@ -33,14 +34,16 @@ def decode_segments
3334
3435 private
3536
37+ def verify_algo
38+ raise ( JWT ::IncorrectAlgorithm , 'An algorithm must be specified' ) if allowed_algorithms . empty?
39+ raise ( JWT ::IncorrectAlgorithm , 'Expected a different algorithm' ) unless options_includes_algo_in_header?
40+ end
41+
3642 def verify_signature
3743 @key = find_key ( &@keyfinder ) if @keyfinder
3844 @key = ::JWT ::JWK ::KeyFinder . new ( jwks : @options [ :jwks ] ) . key_for ( header [ 'kid' ] ) if @options [ :jwks ]
3945 @key = JWT ::X5cKeyFinder . from ( header [ 'x5c' ] , @options . fetch ( :root_certificates ) , @options [ :crls ] ) if header [ 'x5c' ]
4046
41- raise ( JWT ::IncorrectAlgorithm , 'An algorithm must be specified' ) if allowed_algorithms . empty?
42- raise ( JWT ::IncorrectAlgorithm , 'Expected a different algorithm' ) unless options_includes_algo_in_header?
43-
4447 Signature . verify ( header [ 'alg' ] , @key , signing_input , @signature )
4548 end
4649
You can’t perform that action at this time.
0 commit comments