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):
47
47
48
48
49
49
def jwt_decode_handler (token ):
50
+ options = {
51
+ 'verify_exp' : api_settings .JWT_VERIFY_EXPIRATION ,
52
+ }
53
+
50
54
return jwt .decode (
51
55
token ,
52
56
api_settings .JWT_SECRET_KEY ,
53
57
api_settings .JWT_VERIFY ,
54
- verify_expiration = api_settings . JWT_VERIFY_EXPIRATION ,
58
+ options = options ,
55
59
leeway = api_settings .JWT_LEEWAY ,
56
60
audience = api_settings .JWT_AUDIENCE ,
57
61
issuer = api_settings .JWT_ISSUER ,
Original file line number Diff line number Diff line change 18
18
author_email = '[email protected] '
19
19
license = 'MIT'
20
20
install_requires = [
21
- 'PyJWT>=1.0 .0,<2.0.0' ,
21
+ 'PyJWT>=1.1 .0,<2.0.0' ,
22
22
]
23
23
24
24
Original file line number Diff line number Diff line change @@ -57,6 +57,16 @@ def test_jwt_response_payload(self):
57
57
58
58
self .assertEqual (response_data , dict (token = token ))
59
59
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
+
60
70
61
71
class TestAudience (TestCase ):
62
72
def setUp (self ):
You can’t perform that action at this time.
0 commit comments