File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -303,6 +303,6 @@ def get_claim_cls_by_response_type(response_type):
303303
304304def _verify_hash (signature , s , alg ):
305305 hash_value = create_half_hash (s , alg )
306- if not hash_value :
307- return True
306+ if hash_value is None :
307+ return False
308308 return hmac .compare_digest (hash_value , to_bytes (signature ))
Original file line number Diff line number Diff line change @@ -99,9 +99,10 @@ def test_validate_at_hash():
9999 )
100100 claims .params = {"access_token" : "a" }
101101
102- # invalid alg won't raise
102+ # invalid alg will raise too
103103 claims .header = {"alg" : "HS222" }
104- claims .validate (1000 )
104+ with pytest .raises (InvalidClaimError ):
105+ claims .validate (1000 )
105106
106107 claims .header = {"alg" : "HS256" }
107108 with pytest .raises (InvalidClaimError ):
@@ -143,10 +144,11 @@ def test_hybrid_id_token():
143144 with pytest .raises (MissingClaimError ):
144145 claims .validate (1000 )
145146
146- # invalid alg won't raise
147+ # invalid alg will raise too
147148 claims .header = {"alg" : "HS222" }
148149 claims ["c_hash" ] = "a"
149- claims .validate (1000 )
150+ with pytest .raises (InvalidClaimError ):
151+ claims .validate (1000 )
150152
151153 claims .header = {"alg" : "HS256" }
152154 with pytest .raises (InvalidClaimError ):
You can’t perform that action at this time.
0 commit comments