Repository navigation
Replies: 6 comments 15 replies
|
The old issue KEYCLOAK-8278 also contains some discussions around reference token support for Keycloak. |
|
@thomasdarimont Thank you Thomas. In my plan, a user can customize the format of a reference token by themselves. For example, a random string, including some information (timestamp, etc...). |
|
Concept for reference tokens with own cache SPI sounds good! |
|
We discussed the topic of reference tokens with @stianst and 10000 @tnorimat. The big challenge of this reference tokens proposal is how to store the tokens on Keycloak side? The possible options are:
The (3) is most ideal solution. This means that access-token (and possibly refresh-token) would be still signed JWT, however it will be very lightweight and may not contain any user private info (PII). Some info below on what may be required to achieve this in Keycloak: More flexibility for Introspection endpointCurrent Token Introspection endpoint (and especially Possibility to hide sub claim from access tokenAFAIK most of the user PII claims are added to access token (and IDToken and UserInfo) by protocol mappers, however the I am not 100% sure if this capability is needed for reference tokens, but might be useful as it will allow to hide Client policy executorThe Takashi's PR [1] already uses client policies for reference tokens. We can perhaps have an executor, which will allow to:
MilestonesWe can possibly implement this in milestones, so it is not 1 big PR contains everything. I can imagine something like: Milestone 1: Introspection endpoint Milestone 2: Client policy executor (maybe just update of the PR [1] is OK), which will switch Milestone 3: Protocol mapper (and client scope) for [1] #19824 |
|
@mposolda I agree with your milestone. I will create an issue per each. |
|
Token Introspection enchance is also needed in lightway access token (see realted discussion. We believe that Keycloak should also support this. We could make a PR for Token Introspection enhance if we agree in business. We believe that a field 'Add to introspection response' field in most of protocol mappers is enough. This field will be shown only if 'Add to access token' is false. Token Introspection endpoint will be enchanced by mappers of scopes that 'Add to introspection response' field is true. Keycloak already support changing sub claim by creating a protocol mapper with sub claim. We use it. Sub claim is required based on JSON Web Token (JWT) Profile for OAuth 2.0 Access Tokens. So I do not believe that a user must be able to remove it. We only add preferred_username claim in client credentials flow for being able to use this access token in Token Introspection and UserInfo Endpoint. A note in documentation for this maybe is enough. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There are two types of tokens:
Currently, Keycloak only supports a self-contained token. How about supporting also reference token?
Motivation for a reference token is as follows:
Other solution to resolve the points above is as follows:
Namely, there are three types of solution: light weight token, token encryption, and reference token.
The basic concept of supporting a reference token is the following:
The major concern for supporting a reference token is the following (just mentioned in Light weight access token's discussion)
To resolve the concern, the following way can be taken:
IMO, to support Light weight access token support and token encryption, we need to modify Keycloak's body codes. I have an idea to support a reference token without modifying keycloak's body codes heavily:
Other points:
I considered specifications of supporting reference access/refresh tokens and wrote them in the issue.
I have already implemented PoC codes for it the by following the specifications and confirmed that they work well as I expected.
All reactions