Description
The WebClient
extensions for OAuth 2.0 Client are supported via ServletOAuth2AuthorizedClientExchangeFilterFunction
(Servlet) and ServerOAuth2AuthorizedClientExchangeFilterFunction
(WebFlux).
The ServerOAuth2AuthorizedClientExchangeFilterFunction
(WebFlux) uses a collaborator OAuth2AuthorizedClientResolver
to realize part of the feature set. However, ServletOAuth2AuthorizedClientExchangeFilterFunction
(Servlet) doesn't have such a collaborator and therefore all the code is contained within. We should consider adding an OAuth2AuthorizedClientResolver
equivalent for the Servlet version to align the code and provide consistency.
Furthermore, as we continue to add support for other grant types, e.g. Resource Owner Password Credentials #6003, the code within each ExchangeFilterFunction
could grow quite a bit making it more complex and harder to maintain. It is also preferred that the code in each ExchangeFilterFunction
is aligned/consistent and reused wherever possible. However, we need to be careful with reuse and ensure we don't introduce a blocking operation within the reactive implementation.
As part of this decomposition exercise, we should consider re-structuring components/collaborators so they can potentially be reused by other technology stacks, e.g. WebFlux's WebSocketClient
#6711, RestTemplate
or Feign Client.
This issue is divided into the following tasks.
Servlet
- #17 Introduce
OAuth2AuthorizedClientProvider
- #18 Implement
authorization_code
OAuth2AuthorizedClientProvider
- #19 Implement
client_credentials
OAuth2AuthorizedClientProvider
- #20 Add
refresh_token
OAuth2AccessTokenResponseClient
- #21 Implement
refresh_token
OAuth2AuthorizedClientProvider
- #22 Implement delegating
OAuth2AuthorizedClientProvider
- #29 Refactor and use
OAuth2AuthorizedClientProvider
implementations - #37 Simplify population of OAuth2AuthorizationContext
- #59 Redesign
OAuth2AuthorizedClientProvider
to load/saveOAuth2AuthorizedClient
- #60
ClientCredentialsOAuth2AuthorizedClientProvider
should load/saveOAuth2AuthorizedClient
- #61
RefreshTokenOAuth2AuthorizedClientProvider
should load/saveOAuth2AuthorizedClient
- #62 Refactor and use redesigned OAuth2AuthorizedClientProvider implementations
Reactive
- #42 Introduce
ReactiveOAuth2AuthorizedClientProvider
- #43 Implement
authorization_code
ReactiveOAuth2AuthorizedClientProvider
- #44 Implement
client_credentials
ReactiveOAuth2AuthorizedClientProvider
- #45 Add
refresh_token
ReactiveOAuth2AccessTokenResponseClient
- #46 Implement
refresh_token
ReactiveOAuth2AuthorizedClientProvider
- #47 Implement delegating
ReactiveOAuth2AuthorizedClientProvider
- #86 Add builder for
ReactiveOAuth2AuthorizedClientProvider
- #87 Introduce
ReactiveOAuth2AuthorizedClientManager
- #48 Refactor and use
ReactiveOAuth2AuthorizedClientManager/Provider
(s)