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.
Related #6683, #6780
This issue is divided into the following tasks.
Servlet
Reactive
The
WebClientextensions for OAuth 2.0 Client are supported viaServletOAuth2AuthorizedClientExchangeFilterFunction(Servlet) andServerOAuth2AuthorizedClientExchangeFilterFunction(WebFlux).The
ServerOAuth2AuthorizedClientExchangeFilterFunction(WebFlux) uses a collaboratorOAuth2AuthorizedClientResolverto 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 anOAuth2AuthorizedClientResolverequivalent 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
ExchangeFilterFunctioncould grow quite a bit making it more complex and harder to maintain. It is also preferred that the code in eachExchangeFilterFunctionis 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,RestTemplateor Feign Client.Related #6683, #6780
This issue is divided into the following tasks.
Servlet
OAuth2AuthorizedClientProviderauthorization_codeOAuth2AuthorizedClientProviderclient_credentialsOAuth2AuthorizedClientProviderrefresh_tokenOAuth2AccessTokenResponseClientrefresh_tokenOAuth2AuthorizedClientProviderOAuth2AuthorizedClientProviderOAuth2AuthorizedClientProviderimplementationsOAuth2AuthorizedClientProviderto load/saveOAuth2AuthorizedClientClientCredentialsOAuth2AuthorizedClientProvidershould load/saveOAuth2AuthorizedClientRefreshTokenOAuth2AuthorizedClientProvidershould load/saveOAuth2AuthorizedClientReactive
ReactiveOAuth2AuthorizedClientProviderauthorization_codeReactiveOAuth2AuthorizedClientProviderclient_credentialsReactiveOAuth2AuthorizedClientProviderrefresh_tokenReactiveOAuth2AccessTokenResponseClientrefresh_tokenReactiveOAuth2AuthorizedClientProviderReactiveOAuth2AuthorizedClientProviderReactiveOAuth2AuthorizedClientProviderReactiveOAuth2AuthorizedClientManagerReactiveOAuth2AuthorizedClientManager/Provider(s)