Skip to content

KEYCLOAK-10761 Add support for encrypted access tokens#6796

Closed
thomasdarimont wants to merge 3 commits intokeycloak:masterfrom
thomasdarimont:issue/KEYCLOAK-XXX-Add-Support-for-AccessToken-Encryption
Closed

KEYCLOAK-10761 Add support for encrypted access tokens#6796
thomasdarimont wants to merge 3 commits intokeycloak:masterfrom
thomasdarimont:issue/KEYCLOAK-XXX-Add-Support-for-AccessToken-Encryption

Conversation

@thomasdarimont
Copy link
Copy Markdown
Contributor

Leveraged existing IDToken encryption support for AccessToken encryption.
Added appropriate configuration options to "Advanced OIDC Client Settings" in admin-console.
Note: Signed & Encrypted JWTs need cty: "JWT" (the content-type) in the JWE header.

Copy link
Copy Markdown
Contributor

@tnorimat tnorimat left a comment

Choose a reason for hiding this comment

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

I've made 2 comments. I would be happy if you check them.

Comment thread themes/src/main/resources/theme/base/admin/messages/admin-messages_en.properties Outdated
@stianst stianst added this to the 10.0.0 milestone Feb 18, 2020
@stianst stianst added the Hold label Feb 18, 2020
@thomasdarimont
Copy link
Copy Markdown
Contributor Author

@tnorimat thanks for your review! I adapted the PR according to your suggestions.

tnorimat
tnorimat previously approved these changes Feb 18, 2020
Copy link
Copy Markdown
Contributor

@tnorimat tnorimat left a comment

Choose a reason for hiding this comment

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

LGTM

@thomasdarimont thomasdarimont force-pushed the issue/KEYCLOAK-XXX-Add-Support-for-AccessToken-Encryption branch from b2a6302 to 7dc25cc Compare February 18, 2020 20:35
laszlomiklosik
laszlomiklosik previously approved these changes Apr 6, 2020
@stianst stianst removed the Hold label Apr 20, 2020
@stianst stianst modified the milestones: 10.0.0, 11.0.0 Apr 21, 2020
@stianst stianst requested review from mposolda and pedroigor April 21, 2020 09:30
@stianst
Copy link
Copy Markdown
Contributor

stianst commented Apr 22, 2020

Haven't had a chance to look at this yet, but how does this work with the token introspection endpoint, and things like the userinfo endpoint?

For the token introspection endpoint it is obviously important that it can't be used by any client to decrypt the token, as that would then to some extent defeat the purpose of encrypting it. Keycloak can't really even decrypt the token can it?

For the userinfo endpoint I would imagine that Keycloak can't actually verify the token, so can't use the token for this purpose.

Does this also have some impact on authz services, or anything else where the app may pass the token to Keycloak? Token exchange perhaps?

Copy link
Copy Markdown
Contributor

@pedroigor pedroigor left a comment

Choose a reason for hiding this comment

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

@thomasdarimont @stianst Your concerns are relevant.

in addition to them, I think we are also missing some other parts in regards to ID Token encryption (which we already support). For instance, endpoints using id_token_hint (e.g.: logout) do not seem to support encrypted ID Tokens. Probably a separate issue.

For this particular change, I think we also need to change the TokenVerifier to support encryption. This one is used in several places today to check signatures and decode tokens. Including UserInfo and Introspection endpoints.

For authorization services, the same is also true.

@thomasdarimont Would you mind providing tests for userinfo and introspection endpoints ?

@thomasdarimont thomasdarimont force-pushed the issue/KEYCLOAK-XXX-Add-Support-for-AccessToken-Encryption branch from 7dc25cc to 5d7af6b Compare May 24, 2020 01:01
@thomasdarimont
Copy link
Copy Markdown
Contributor Author

I just rebased this on the current master. I'll take a look into tests for userinfo and introspection endpoints.

@thomasdarimont thomasdarimont force-pushed the issue/KEYCLOAK-XXX-Add-Support-for-AccessToken-Encryption branch 2 times, most recently from 6e85e1d to 06234cd Compare May 24, 2020 01:07
@stianst stianst removed their request for review June 15, 2020 11:02
@mposolda
Copy link
Copy Markdown
Contributor

@thomasdarimont Any updates regarding the tests as discussed in previous comments?

@mposolda mposolda added area/oidc Indicates an issue on OIDC area area/core impact/medium labels Jun 19, 2020
Leveraged existing IDToken encryption support for AccessToken encryption.
Note: Signed & Encrypted JWTs need cty: "JWT" (the content-type) in the JWE header.
@thomasdarimont thomasdarimont force-pushed the issue/KEYCLOAK-XXX-Add-Support-for-AccessToken-Encryption branch from 06234cd to 5a9c5eb Compare June 19, 2020 15:23
@thomasdarimont
Copy link
Copy Markdown
Contributor Author

@pedroigor I had no time to look at it yet. I just rebased the stuff on top of current master.
Could you give me some guidance what's missing in detail?
Would it be sufficient if I add support for the user-info and token introspection endpoint for encrypted access-tokens?

@pedroigor
Copy link
Copy Markdown
Contributor

@thomasdarimont Yeah, making sure both user-info and introspection endpoints work with your changes should be OK.

@pedroigor
Copy link
Copy Markdown
Contributor

Hey @thomasdarimont. Were you able to test encrypt tokens using both userinfo and introspection endpoints?

@testn
Copy link
Copy Markdown
Contributor

testn commented Jul 17, 2020

@thomasdarimont did you get a chance to take a look?

@mposolda
Copy link
Copy Markdown
Contributor

I am closing the PR due the lack of feedback.

@thomasdarimont Feel free to re-open anytime you have a chance to address the comments above.

@mposolda mposolda closed this Jul 30, 2020
@thomasdarimont
Copy link
Copy Markdown
Contributor Author

@mposolda sorry for letting this go stale again... I didn't have much time lately and therefore I couldn't work on this as much as I hoped. Also this is getting quite complex and I think I need some additional guidance or even pair programming. It currently feels like a walk through the desert with lots of scorpions, thorny bushes, sandsnakes and misguiding Fata Morganas, which might feel a bit less uneasy with some company ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core area/oidc Indicates an issue on OIDC area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants