-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Token Exchange does not support id_token token type #1880
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
Comments
@banterCZ Please note that the initial implementation of OAuth 2.0 Token Exchange was intentionally implemented with minimal capability, hence the reason why Unfortunately, there were no examples provided for Our plan is to expand the support as we discover real-world use cases from our users. We're open to enhancements, but we first need to understand the use case. Can you please provide details on your use case and the reason why you would need to exchange an |
The main idea was to exchange a long-lived |
I'll need more detail as this doesn't appear to be a valid use case at this point. FYI, if you need a shorter-lived
What do you mean by limited scope? Please provide specific details for your use case. |
This is the issue I submitted, but it was closed. |
@chenzhenjia I don't see how gh-1866 is related to this issue? The UserInfo endpoint accepts an access token NOT an ID Token. This issue is specific to exchanging an ID Token. If you have further comments, please comment in gh-1866. |
Hello @jgrandja , The scenario for the Token Exchange of
|
@zcgandcomp Thanks for the details.
This does not appear to be a valid use case as clients are not intended to send ID tokens to a Resource Server (newsletter subscription service). I'm curious, why are you sending an ID Token instead of an access token to the resource server? Why can't you send an (exchanged) access token with limited scope? |
I see an ID token as my digitally signed identity, so the newsletter server receives some data signed by the authorization server that can be trusted for this purpose. So, the ID tokens are used to share a limited scope of data between different systems. I'm signing up using my ID token, but after the signup, the authentication and authorization are handled by the newsletter authorization server). True - the user can get a new ID token with limited claims (by using the issued access token), but the ID tokens usually have longer validity, refresh tokens might be expired or not used) so an easier solution is to exchange ID tokens directly. |
@zcgandcomp As per section 3. Authentication:
The ID Token is intended for the Client during the authentication flow and it relies on the ID Token to successfully authenticate the end user.
This does not align with the intended use of the ID Token. A more common use case would be an X.509 certificate to represent your digital identity. Unfortunately, RFC 8693 OAuth 2.0 Token Exchange does not specify a use case for exchanging an ID Token. At this point, this issue will likely get closed as I don't believe passing an ID Token to a resource server is a valid use case. If you can provide me a reference of this use case that is used by a well known OIDC provider then we can look into this further. |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Hello, let's look at it this way: If I want to have another IDToken with fewer claims I need to:
Our intention was:
The flow has fewer steps and is more robust, and is less frictionless (no user interaction is needed). The RFC is vague, I believe on purpose, as it doesn't want to restrict too much and enables solving real-life situations. |
An alternative to token exchange is you could use the You need to ensure a refresh token is returned so in the above flow you need "get refresh token for client A" as well. Now client A has an access token, ID token and refresh token. Then you can perform a
Maybe. Either way, the flows you have described are completely custom and this would be the responsibility of the consuming application. The main responsibility of Spring Authorization Server is to provide implementations of the various specifications. If off-spec or custom behaviours are needed, then it's the responsibility of the consuming application. If there are hooks in the framework that are needed to implement these customizations then we can consider adding new hooks. Please look into this on your end and if you need another extension point then we can look into this further. As of now, I don't see any changes on our end. I'll leave this issue open for now and we'll see if other users are looking for an ID Token exchange flow. |
Hello, The flow is nothing off-spec. The spec clearly allows to exchange ID Tokens: https://datatracker.ietf.org/doc/html/rfc8693#name-token-type-identifiers We can call the exchange of I can accept you are not going to support it in core, but not the statement that this is off-spec. Can you please check: #877 because the implementation of the scope claim is actually not according to the specification (for token exchange). |
To be more clear, when I say off-spec, I'm referring to this specific part in your flow:
You're switching client A to client B, which is completely custom. Again, the spec allows ID Token exchange but does not provide any other information whatsoever on the requirements of the exchange. At a minimum, there should at least be some validation requirements before allowing the exchange to proceed. Furthermore, I would almost guarantee that switching client ID's would NOT be allowed. Thanks for the reminder of gh-877, I will look into that shortly. |
I'm sorry we did not provide consistent requests. We will try to put it together to avoid misunderstanding. I haven't described the client switching clearly. I was trying to make an analogy to the https://datatracker.ietf.org/doc/html/rfc8693#name-example-token-exchange But we can put together the same description as RFC to make it clear. |
@zcgandcomp Yes please put together a minimal sample of the flow you are trying to achieve and then I can look at it to better understand and see if we can come up with a solution. |
Spring Authorization Server supports the Exchange Token feature; introduced in #60
According to RFC 8693, the token type
id_token
is valid, but not supported by OAuth2TokenExchangeAuthenticationConverter, which accepts onlyjwt
andaccess_token
.Moreover, the class is final without any extension points. Right now, the whole
AuthenticationConverter
has to be implemented.The same situation is for OAuth2TokenExchangeAuthenticationProvider, that always issues an access token.
I already asked at StackOverflow, but it seems that it is more of a feature request than just a question.
The text was updated successfully, but these errors were encountered: