This repository was archived by the owner on May 26, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -47,11 +47,15 @@ def jwt_encode_handler(payload):
4747
4848
4949def jwt_decode_handler (token ):
50+ options = {
51+ 'verify_exp' : api_settings .JWT_VERIFY_EXPIRATION ,
52+ }
53+
5054 return jwt .decode (
5155 token ,
5256 api_settings .JWT_SECRET_KEY ,
5357 api_settings .JWT_VERIFY ,
54- verify_expiration = api_settings . JWT_VERIFY_EXPIRATION ,
58+ options = options ,
5559 leeway = api_settings .JWT_LEEWAY ,
5660 audience = api_settings .JWT_AUDIENCE ,
5761 issuer = api_settings .JWT_ISSUER ,
Original file line number Diff line number Diff line change 1818author_email = 'jpadilla@getblimp.com'
1919license = 'MIT'
2020install_requires = [
21- 'PyJWT>=1.0 .0,<2.0.0' ,
21+ 'PyJWT>=1.1 .0,<2.0.0' ,
2222]
2323
2424
Original file line number Diff line number Diff line change @@ -57,6 +57,16 @@ def test_jwt_response_payload(self):
5757
5858 self .assertEqual (response_data , dict (token = token ))
5959
60+ def test_jwt_decode_verify_exp (self ):
61+ api_settings .JWT_VERIFY_EXPIRATION = False
62+
63+ payload = utils .jwt_payload_handler (self .user )
64+ payload ['exp' ] = 1
65+ token = utils .jwt_encode_handler (payload )
66+ utils .jwt_decode_handler (token )
67+
68+ api_settings .JWT_VERIFY_EXPIRATION = True
69+
6070
6171class TestAudience (TestCase ):
6272 def setUp (self ):
You can’t perform that action at this time.
0 commit comments