Open
Description
The Token class currently lacks support for setting and verifying the aud
(audience) and iss
(issuer) claims, which are part of the JWT standard as defined in RFC 7519. These claims are essential for validating tokens in multi-service/tenant environments where tokens are issued by one service and consumed by another.
Proposed Solution
-
Add Methods to Set and Verify Claims:
- Introduce methods like
set_aud
andset_iss
to populate theaud
andiss
claims when creating tokens. - Add a
verify_aud
andverify_iss
method to validate these claims during token verification.
- Introduce methods like
-
Configuration Options:
- Add settings in api_settings to define default values for
aud
andiss
claims. - Allow these settings to be overridden dynamically when creating tokens.
- Add settings in api_settings to define default values for
-
Backward Compatibility:
- Ensure that these changes are optional and do not break existing functionality for users who do not require
aud
andiss
claims.
- Ensure that these changes are optional and do not break existing functionality for users who do not require