Skip to content

Commit

Permalink
Remove verify from jwt.decode() to follow PyJWT v2.2.0. (#472)
Browse files Browse the repository at this point in the history
* Fix test not to overwrite PyJWT.decode with PyJWS.decode.

Co-authored-by: Andrew Chen Wang <60190294+Andrew-Chen-Wang@users.noreply.github.com>
  • Loading branch information
dajiaji and Andrew-Chen-Wang committed Oct 12, 2021
1 parent 7759aa8 commit 43d5b2f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 0 additions & 1 deletion rest_framework_simplejwt/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def decode(self, token, verify=True):
token,
self.get_verifying_key(token),
algorithms=[self.algorithm],
verify=verify,
audience=self.audience,
issuer=self.issuer,
leeway=self.leeway,
Expand Down
4 changes: 3 additions & 1 deletion tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,9 @@ def test_decode_when_algorithm_not_available(self):

pyjwt_without_rsa = PyJWS()
pyjwt_without_rsa.unregister_algorithm('RS256')
with patch.object(jwt, 'decode', new=pyjwt_without_rsa.decode):
def _decode(jwt, key, algorithms, options, audience, issuer, leeway):
return pyjwt_without_rsa.decode(jwt, key, algorithms, options)
with patch.object(jwt, 'decode', new=_decode):
with self.assertRaisesRegex(TokenBackendError, 'Invalid algorithm specified'):
self.rsa_token_backend.decode(token)

Expand Down

0 comments on commit 43d5b2f

Please sign in to comment.