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

jws: Header - make fields extensible or implement other registered ones #193

Open
ramoas opened this issue Jul 21, 2016 · 3 comments
Open

Comments

@ramoas
Copy link

ramoas commented Jul 21, 2016

Support for Key ID ("kid") was recently added as a supported Header field. I was using Key ID prior to its addition, but because there's no extensible way to add Header fields, I had to basically duplicate all the other code.

There are other optional header fields mentioned in RFC 7515 that remain unimplemented. For example, "jwk" and "x5c".

If additional support for the remaining registered JWS header types will not be added, then please make Header extensible in some natural way to maximize code re-use if additional fields are needed. Perhaps like ClaimSet.PrivateClaimsSet where there's a map[string]interface{}.

@rakyll
Copy link
Contributor

rakyll commented Aug 26, 2016

Is there any case where the header can be considered in the scope of JWT? JWS package is not a generic implementation of JSON Web messages but rather is scoped to its use with OAuth2 JWT. Also see #196.

@ramoas
Copy link
Author

ramoas commented Aug 26, 2016

@rakyll Yes, the other JWS header types are definitely useful in the context of OAuth2 JWT, especially the two examples that I mentioned: "jwk" and "x5c". As a workaround, you can encode any arbitrary case-sensitive string in "kid", but if the spec calls for additional header types, it would be great to either implement more of them or make it possible for others to implement them but still reuse all the other code for signing / verifying and encoding / decoding.

@rakyll
Copy link
Contributor

rakyll commented Aug 26, 2016

It would be also good to add extensions to the jwt package so the users can pick a non-default header and grant type. Currently, everyone is restricted to the hardcoded values at https://github.com/golang/oauth2/blob/master/jwt/jwt.go#L28.

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

2 participants