You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: