Add controls for verify_sub option in PyJWT
#562
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses the discussion in this issue: #561
For people who have historically been using values for the
subclaim other than strings, they may need or want the ability to control PyJWT's new behavior (as of 2.10.0) which is to reject those tokens as invalid.This work adds a new option
JWT_VERIFY_SUBwhich can be used to control theverify_suboption when callingjwt.decode(...)from the PyJWT library.The default value for
JWT_VERIFY_SUBisTrue, which results in thesubclaim being verified. This default results in no change to how the library behaved prior to this addition. By choosing to setJWT_VERIFY_SUBtoFalse, the user can turn off theverify_suboption in thejwt.decodecall.I welcome feedback on the naming or anything else regarding the implementation. Also, please let me know if I missed any places where this needs to be tested or documented. Thanks!