-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SPR1-2674 Fix token tests for PyJWT >= 2.2.0
In order to avoid a test dependency on the cryptography package, I had a sneaky way to encode tokens with the "none" algorithm, even though the header requested "ES256" like a real MeerKAT token. I took the resultant unsecured JWS and then tacked on a dummy signature of the expected length of 86 characters, since that is all that matters to katdal. Sadly this trick stopped working in PyJWT >= 2.2.0, thanks to [jpadilla/pyjwt#673](jpadilla/pyjwt#673). The latest PyJWT prefers the algorithm in the header and won't let it be overridden by the `algorithm` parameter to `jwt.encode()`. Instead of inventing more tricks, take the hit and add cryptography to the test requirements. Use the example private key found in the PyJWT unit tests. There is no need for the corresponding public key, since katdal only checks some basic aspects of the token without verifying the signature.
- Loading branch information
1 parent
eb8db22
commit b00f9b3
Showing
3 changed files
with
15 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,4 +61,4 @@ | |
's3': [], | ||
's3credentials': ['botocore'] | ||
}, | ||
tests_require=['nose']) | ||
tests_require=['nose', 'cryptography']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
-c https://raw.githubusercontent.com/ska-sa/katsdpdockerbase/master/docker-base-build/base-requirements.txt | ||
|
||
cffi==1.15.1 # via cryptography | ||
coverage | ||
cryptography==38.0.3 | ||
nose | ||
pycparser==2.21 # via cffi |