auth0/go-jwt-middleware

Support for dynamic public key from jwt token

Opened this issue · 0 comments

Checklist

Describe the problem you'd like to have solved

I am upgrading my go-jwt-middleware pkg from v1 to v2. In older implementation there was option to generate public key from token. here is the sample code
func GetJwtMiddleware() *jwtmiddleware.JWTMiddleware { jwtMiddleware := jwtmiddleware.New(jwtmiddleware.Options{ ValidationKeyGetter : func(token *jwt.Token) (interface{}, error) { cert, err := getPemCert(token) if err != nil { panic(err.Error()) } result, _ := jwt.ParseRSAPublicKeyFromPEM([]byte(cert)) return result, nil } SigningMethod: jwt.SigningMethodRS256, }) return jwtMiddleware }

But in V2, there is no option generate public key from token as token is not available in keyFunc function.

Describe the ideal solution

JWT token should be available in keyFunc function along with ctx

Alternatives and current workarounds

No response

Additional context

No response