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

Keyfunc usage and token Parsing examples #58

Open
lggomez opened this issue Aug 3, 2021 · 3 comments
Open

Keyfunc usage and token Parsing examples #58

lggomez opened this issue Aug 3, 2021 · 3 comments
Labels
documentation Improvements or additions to documentation jwt-go: legacy

Comments

@lggomez
Copy link
Member

lggomez commented Aug 3, 2021

Migrated from dgrijalva/jwt-go#456

moloch-- commented on Feb 28

The https://pkg.go.dev/github.com/dgrijalva/jwt-go#Keyfunc does not specify what should be returned, it simply says "supply the key for verification." Should the function return the JSON key structure? A byte array of the base64 encoded public key? A byte array of the raw key material? A PEM encoded key? A parsed RSA Key?

The documentation should specify what is returned when, assuming different values should be returned for different signing mechanism.

The function signature is also documented as func(token *jwt.Token) ([]byte, error), however in practice it seems the function must be implemented as func(token *jwt.Token) (interface{}, error)

@lggomez lggomez added documentation Improvements or additions to documentation jwt-go: legacy labels Aug 3, 2021
@lggomez
Copy link
Member Author

lggomez commented Aug 3, 2021

moloch-- commented on Mar 3 •

For anyone that finds this, you want to return the parsed rsa.* key or ecsda.* key, not a []byte.

@lggomez
Copy link
Member Author

lggomez commented Aug 3, 2021

Also see: dgrijalva/jwt-go#452

@lggomez
Copy link
Member Author

lggomez commented Aug 3, 2021

Also related: dgrijalva/jwt-go#386

@lggomez lggomez changed the title Keyfunc Keyfunc usage and token Parsing examples Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation jwt-go: legacy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant