Polish docs for WebClient OAuth2 Servlet Setup
This commit is contained in:
parent
07d2e43d7a
commit
88f8bfeb57
|
@ -29,15 +29,15 @@ Spring Security builds on this support to provide additional benefits:
|
|||
== WebClient OAuth2 Setup
|
||||
|
||||
The first step is ensuring to setup the `WebClient` correctly.
|
||||
An example of setting up `WebClient` in a fully reactive environment can be found below:
|
||||
An example of setting up `WebClient` in a servlet environment can be found below:
|
||||
|
||||
[source,java]
|
||||
----
|
||||
@Bean
|
||||
WebClient webClient(ReactiveClientRegistrationRepository clientRegistrations,
|
||||
ServerOAuth2AuthorizedClientRepository authorizedClients) {
|
||||
ServerOAuth2AuthorizedClientExchangeFilterFunction oauth =
|
||||
new ServerOAuth2AuthorizedClientExchangeFilterFunction(clientRegistrations, authorizedClients);
|
||||
WebClient webClient(ClientRegistrationRepository clientRegistrations,
|
||||
OAuth2AuthorizedClientRepository authorizedClients) {
|
||||
ServletOAuth2AuthorizedClientExchangeFilterFunction oauth =
|
||||
new ServletOAuth2AuthorizedClientExchangeFilterFunction(clientRegistrations, authorizedClients);
|
||||
// (optional) explicitly opt into using the oauth2Login to provide an access token implicitly
|
||||
// oauth.setDefaultOAuth2AuthorizedClient(true);
|
||||
// (optional) set a default ClientRegistration.registrationId
|
||||
|
@ -67,7 +67,7 @@ Mono<String> body = this.webClient
|
|||
[[servlet-webclient-explicit]]
|
||||
== Explicit OAuth2AuthorizedClient
|
||||
|
||||
The `OAuth2AuthorizedClient` can be explicitly provided by setting it on the requests attributes.
|
||||
The `OAuth2AuthorizedClient` can be explicitly provided by setting it on the request attributes.
|
||||
In the example below we resolve the `OAuth2AuthorizedClient` using Spring WebFlux or Spring MVC argument resolver support.
|
||||
However, it does not matter how the `OAuth2AuthorizedClient` is resolved.
|
||||
|
||||
|
|
Loading…
Reference in New Issue