@@ -428,6 +428,27 @@ def test_jti_invalid(self, key):
428428 with pytest .raises (JWTError ):
429429 jwt .decode (token , key )
430430
431+ def test_at_hash (self , claims , key ):
432+ access_token = '<ACCESS_TOKEN>'
433+ token = jwt .encode (claims , key , access_token = access_token )
434+ payload = jwt .decode (token , key , access_token = access_token )
435+ assert 'at_hash' in payload
436+
437+ def test_at_hash_invalid (self , claims , key ):
438+ token = jwt .encode (claims , key , access_token = '<ACCESS_TOKEN>' )
439+ with pytest .raises (JWTError ):
440+ jwt .decode (token , key , access_token = '<OTHER_TOKEN>' )
441+
442+ def test_at_hash_missing_access_token (self , claims , key ):
443+ token = jwt .encode (claims , key , access_token = '<ACCESS_TOKEN>' )
444+ with pytest .raises (JWTError ):
445+ jwt .decode (token , key )
446+
447+ def test_at_hash_missing_claim (self , claims , key ):
448+ token = jwt .encode (claims , key )
449+ with pytest .raises (JWTError ):
450+ jwt .decode (token , key , access_token = '<ACCESS_TOKEN>' )
451+
431452 def test_unverified_claims_string (self ):
432453 token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.aW52YWxpZCBjbGFpbQ.iOJ5SiNfaNO_pa2J4Umtb3b3zmk5C18-mhTCVNsjnck'
433454 with pytest .raises (JWTError ):
0 commit comments