Commit 1688a8fe authored by Simo Sorce's avatar Simo Sorce

Add checks for Registered Claims

Add 2 new optional parameters that make it possible to check for
the standard registered parameters as well as arbitrary claims are

Now the 'exp' and 'nbf' claims are also checked by default.
Signed-off-by: default avatarSimo Sorce <>

Close #16
parent 0f439146
This diff is collapsed.
......@@ -734,12 +734,16 @@ class TestJWT(unittest.TestCase):
token = T.serialize()
# then try the test vector
T = jwt.JWT(jwt=A1_token, key=key)
T = jwt.JWT(jwt=A1_token, key=key, check_claims=False)
# then try the test vector with explicit expiration date
T = jwt.JWT(jwt=A1_token, key=key, check_claims={'exp': 1300819380})
# Finally check it raises for expired tokens
self.assertRaises(jwt.JWTExpired, jwt.JWT, jwt=A1_token, key=key)
def test_A2(self):
sigkey = jwk.JWK(**A2_example['key'])
Touter = jwt.JWT(jwt=A2_token, key=E_A2_ex['key'])
Tinner = jwt.JWT(, key=sigkey)
Tinner = jwt.JWT(, key=sigkey, check_claims=False)
self.assertEqual(A1_claims, json_decode(
with self.assertRaises(jwe.InvalidJWEData):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment