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

Validate multiple subjects #408

Open
miparnisari opened this issue Sep 16, 2024 · 0 comments
Open

Validate multiple subjects #408

miparnisari opened this issue Sep 16, 2024 · 0 comments

Comments

@miparnisari
Copy link

miparnisari commented Sep 16, 2024

jwt/parser_option.go

Lines 97 to 105 in 5ec246c

// WithSubject configures the validator to require the specified subject in the
// `sub` claim. Validation will fail if a different subject is specified in the
// token or the `sub` claim is missing.
//
// NOTE: While the `sub` claim is OPTIONAL in a JWT, the handling of it is
// application-specific. Since this validation API is helping developers in
// writing secure application, we decided to REQUIRE the existence of the claim,
// if a subject is expected.
func WithSubject(sub string) ParserOption {

Would it be possible to add a convenience validator method jwt.WithSubjects(subjects []string) that returns an error if the request's subject doesn't match any of the subjects?

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

No branches or pull requests

1 participant