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

Example for using certs and RS256 #34

Closed
olbrichj opened this issue Apr 22, 2017 · 1 comment
Closed

Example for using certs and RS256 #34

olbrichj opened this issue Apr 22, 2017 · 1 comment

Comments

@olbrichj
Copy link

Hey,

I'm trying to get this working with RS256 but I seem to do something wrong. As far as I can see, I can't figure out how to return the public cert in the ValidationKeyGetter.

Do you have some example code?

Thanks

@olbrichj
Copy link
Author

Okay I found out how this works:

jwtMiddleware := jwtmiddleware.New(jwtmiddleware.Options{
ValidationKeyGetter: func(token *jwt.Token) (interface{}, error) {
result, _ := jwt.ParseRSAPublicKeyFromPEM([]byte(cert))
return result, nil
},
SigningMethod: jwt.SigningMethodRS256,
})

where cert is a string containing the certificate

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