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

Token Exchange does not support id_token token type #1880

Open
banterCZ opened this issue Jan 16, 2025 · 7 comments
Open

Token Exchange does not support id_token token type #1880

banterCZ opened this issue Jan 16, 2025 · 7 comments
Assignees
Labels
status: waiting-for-feedback We need additional information before we can continue type: enhancement A general enhancement

Comments

@banterCZ
Copy link

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 only jwt and access_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.

@banterCZ banterCZ added the type: enhancement A general enhancement label Jan 16, 2025
@jgrandja
Copy link
Collaborator

jgrandja commented Jan 20, 2025

@banterCZ Please note that the initial implementation of OAuth 2.0 Token Exchange was intentionally implemented with minimal capability, hence the reason why id_token is not currently supported. Our goal for the initial implementation was to implement the use cases defined in Appendix A. Additional Token Exchange Examples.

Unfortunately, there were no examples provided for id_token and it wasn't clear to us how this would be used in the wild.

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 id_token?

@jgrandja jgrandja added the status: waiting-for-feedback We need additional information before we can continue label Jan 20, 2025
@banterCZ
Copy link
Author

The main idea was to exchange a long-lived id_token for another id_token of limited scope. Adding @zcgandcomp too the loop.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jan 21, 2025
@jgrandja
Copy link
Collaborator

@banterCZ

The main idea was to exchange a long-lived id_token for another id_token of limited scope

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 id_token then you can override the default 30 mins as mentioned in this comment.

... for another id_token of limited scope

What do you mean by limited scope? Please provide specific details for your use case.

@jgrandja jgrandja added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Jan 29, 2025
@jgrandja jgrandja self-assigned this Jan 29, 2025
@chenzhenjia
Copy link

This is the issue I submitted, but it was closed.
#1866

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Feb 5, 2025
@jgrandja
Copy link
Collaborator

jgrandja commented Feb 5, 2025

@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.

@jgrandja jgrandja added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Feb 5, 2025
@zcgandcomp
Copy link

Hello @jgrandja ,

The scenario for the Token Exchange of id_token is as follows:

  • A user initiates standard login flow, e.g., via Code Authorization, and uses scope openid and profile.
  • After the flow, the user has an id_token with long validity (days) containing standard claims for profile scope.
  • The client wants to send an id_token to another system, let's say, for a newsletter subscription. But not with all claims but only with the email claim.
  • The client invokes the token exchange, with the requested scope email and receives exchanged id_token with reduced claims.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Feb 5, 2025
@jgrandja
Copy link
Collaborator

@zcgandcomp Thanks for the details.

The client wants to send an id_token to another system, let's say, for a newsletter subscription.

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?

@jgrandja jgrandja added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-feedback We need additional information before we can continue type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

5 participants