Skip to content

[help] Is WithValidMethods parser option actually used? #439

Answered by equalsgibson
mean2me asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @mean2me, the Validator struct provided is in place to validate the entity and entity attributes (claims) within the JWS Payload, and as such it should not be used to verify parameters in the JOSE Header or JWS Signature.

The alg parameter is part of the JOSE header.

If the WithValidMethods() option is used from this library, the given alg in the JWT is validated against the list provided to the WithValidMethods option.

This logic is defined here

https://github.com/golang-jwt/jwt/blob/e9547a11aa603c52a31e315cdcaa71d0f25b921a/parser.go

// ParseWithClaims parses, validates, and verifies like Parse, but supplies a default object implementing the Claims
// interface. This provides defau…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by oxisto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants