Expected Behavior
An ID token issued by a trusted identity provider (e.g., GitLab, Google, GitHub) can be used for token exchange with Spring Authorization Server to obtain an access token.
Current Behavior
Spring Authorization Server does not currently support token exchange using ID tokens.
Context
I am revisiting this topic following a previously closed issue, as we believe there is a valid use case worth reconsidering.
In our setup:
- We expose APIs through Spring Authorization Server to provision OAuth2 clients.
- To maintain consistency across environments (test and production), we use GitLab pipelines to automate client provisioning.
- At present, GitLab authenticates using the client credentials grant to invoke these APIs.
While functional, this approach limits auditability, as all actions are attributed to a shared client rather than the individual who triggered the pipeline.
GitLab provides OIDC support via the GITLAB_OIDC_TOKEN, which represents the identity of the user who initiated the pipeline. Our proposed approach is:
- Register GitLab as a token exchange client in Spring Authorization Server.
- Allow GitLab to present its ID token.
- Exchange this ID token for an access token representing the triggering user.
This would allow us to maintain a proper audit trail of who performed client provisioning actions.
GitLab also exposes a JWKS endpoint (https://gitlab.com/oauth/discovery/keys) for validating ID tokens, making this integration technically feasible. We explored extending or replicating OAuth2TokenExchangeAuthenticationProvider to support this flow; however, since the class is final, customization is not straightforward.
We believe this could be a useful enhancement for Spring Authorization Server and would appreciate your guidance on whether this approach aligns with the intended design, or if there are recommended alternatives.
Thank you very much for your time and consideration.
Tagging @jgrandja @jzheaux
Regards,
Kishore
Expected Behavior
An ID token issued by a trusted identity provider (e.g., GitLab, Google, GitHub) can be used for token exchange with Spring Authorization Server to obtain an access token.
Current Behavior
Spring Authorization Server does not currently support token exchange using ID tokens.
Context
I am revisiting this topic following a previously closed issue, as we believe there is a valid use case worth reconsidering.
In our setup:
While functional, this approach limits auditability, as all actions are attributed to a shared client rather than the individual who triggered the pipeline.
GitLab provides OIDC support via the
GITLAB_OIDC_TOKEN, which represents the identity of the user who initiated the pipeline. Our proposed approach is:This would allow us to maintain a proper audit trail of who performed client provisioning actions.
GitLab also exposes a JWKS endpoint (
https://gitlab.com/oauth/discovery/keys) for validating ID tokens, making this integration technically feasible. We explored extending or replicatingOAuth2TokenExchangeAuthenticationProviderto support this flow; however, since the class is final, customization is not straightforward.We believe this could be a useful enhancement for Spring Authorization Server and would appreciate your guidance on whether this approach aligns with the intended design, or if there are recommended alternatives.
Thank you very much for your time and consideration.
Tagging @jgrandja @jzheaux
Regards,
Kishore