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

Add key id to header #159

Closed
wants to merge 1 commit into from
Closed

Add key id to header #159

wants to merge 1 commit into from

Conversation

pbarker
Copy link

@pbarker pbarker commented May 7, 2017

Adding key id to the header of the id token, per ory/hydra#433.

This implies that the most recent active key is always named 'public'.

Signed-off-by: pbarker [email protected]

Signed-off-by: pbarker <[email protected]>
@coveralls
Copy link

coveralls commented May 7, 2017

Coverage Status

Coverage increased (+0.03%) to 71.958% when pulling c7f3a85 on Grillz:key-id into 575dd79 on ory:master.

Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be addressed here, fosite has the possibility of extracting JWT headers from the session so this should be done in hydra :)

@@ -25,6 +25,8 @@ func (j *RS256JWTStrategy) Generate(claims jwt.Claims, header Mapper) (string, s

token := jwt.NewWithClaims(jwt.SigningMethodRS256, claims)
token.Header = assign(token.Header, header.ToMap())
// "public" is understood to be the most recent keyid
token.Header["kid"] = "public"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually implicit knowledge from hydra, not all keys have a key id of "public". Instead, we should set the key in the header.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So its interesting because the RSA key that is passed into the factory https://github.com/ory/hydra/blob/master/cmd/server/handler_oauth2_factory.go#L66 doesn't have the notion of an ID. I think the token header needs to be added here because it needs to be there before its signed.

We would likely need to modify the https://github.com/ory/fosite/blob/master/compose/compose_strategy.go#L35 to accept a JWT rather than an RSA key, but that may have a cascading effect

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be enough to add that header field in NewSession()

@aeneasr
Copy link
Member

aeneasr commented May 15, 2017

Closing becuase this is merged in hydra now

@aeneasr aeneasr closed this May 15, 2017
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

Successfully merging this pull request may close these issues.

3 participants