Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for specific JOSE header types #161

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lmm-git
Copy link

@lmm-git lmm-git commented Apr 17, 2024

Check https://www.rfc-editor.org/rfc/rfc7519#section-5.1 and https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.9 for more information on when the typ header should be set and to which value.

This commit allows to skip the check altogether as warranted by RFC 7515 the use of the header is optional but if set, according to RFC 7519, it should be set to "JWT". For other token types this is different (see RFC 9068).

Resolves #160

Copy link
Owner

@ramosbugs ramosbugs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR, and for adding tests!

@@ -118,6 +118,7 @@ pub(crate) struct JwtClaimsVerifier<'a, K>
where
K: JsonWebKey,
{
allowed_jose_types: Option<Vec<JsonWebTokenType>>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on my comment in #160, let's just change this to is_typ_check_enabled: bool

@lmm-git lmm-git force-pushed the feature/specific-jose-header-verifiation branch from a3ff11c to 64a6735 Compare April 24, 2024 10:15
@lmm-git lmm-git force-pushed the feature/specific-jose-header-verifiation branch 2 times, most recently from 945841f to 00aec27 Compare May 9, 2024 06:56
Check https://www.rfc-editor.org/rfc/rfc7519#section-5.1 and https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.9 for more information on when the typ header should be set and to which value.

This commit allows to skip the check altogether as warranted by RFC 7515 the use of the header is optional but if set, according to RFC 7519, it should be set to "JWT". For other token types this is different (see RFC 9068).
@lmm-git lmm-git force-pushed the feature/specific-jose-header-verifiation branch from 00aec27 to 3813558 Compare May 21, 2024 14:25
@lmm-git lmm-git marked this pull request as ready for review May 22, 2024 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

typ validation in JWT JOSE header
2 participants