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

Specify clientRegistrationId in TokenRelay filter #2922

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

sjohnr
Copy link
Contributor

@sjohnr sjohnr commented Apr 14, 2023

This PR adds the ability to specify a clientRegistrationId for the TokenRelay GatewayFilter.

  • If the clientRegistrationId is specified, it is used to build the OAuth2AuthorizeRequest.
  • Otherwise, if the user has logged in via oauth2Login(), the existing OAuth2AuthenticationToken.getAuthorizedClientRegistrationId() is used.

With this enhancement, the gateway can be used to manage many ClientRegistrations, and each route can determine which client registration to use. This is incredibly useful in scenarios where there are (for example):

a) multiple authorization servers in use simultaneously
b) multiple client authentication methods in use simultaneously
c) some/all downstream services require a distinct clientId, aud claim, etc.
d) some/all downstream services require different token formats (e.g. JWT, opaque)

@spencergibb spencergibb added this to the 4.1.0-M2 milestone Sep 6, 2023
@spencergibb spencergibb merged commit 984882f into spring-cloud:main Sep 6, 2023
@sjohnr sjohnr deleted the token-relay branch September 6, 2023 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants