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

Support for dynamic public key from jwt token #286

Open
1 task done
prasadsawant12 opened this issue Sep 21, 2024 · 0 comments
Open
1 task done

Support for dynamic public key from jwt token #286

prasadsawant12 opened this issue Sep 21, 2024 · 0 comments
Labels
feature request A feature has been asked for or suggested by the community

Comments

@prasadsawant12
Copy link

prasadsawant12 commented Sep 21, 2024

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

@prasadsawant12 prasadsawant12 added the feature request A feature has been asked for or suggested by the community label Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A feature has been asked for or suggested by the community
Projects
None yet
Development

No branches or pull requests

1 participant