You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/manual/src/docs/asciidoc/_includes/servlet/preface/oauth2-client.adoc
+48
Original file line number
Diff line number
Diff line change
@@ -285,6 +285,54 @@ public OAuth2AuthorizedClientManager authorizedClientManager(
285
285
Spring Boot 2.x auto-configuration registers an `OAuth2AuthorizedClientManager` `@Bean` in the `ApplicationContext`.
286
286
However, the application may choose to override and register a custom `OAuth2AuthorizedClientManager` `@Bean`.
287
287
288
+
The `DefaultOAuth2AuthorizedClientManager` is also associated with a `contextAttributesMapper` of type `Function<OAuth2AuthorizeRequest, Map<String, Object>>`, which is responsible for mapping attribute(s) from the `OAuth2AuthorizeRequest` to a `Map` of attributes to be associated to the `OAuth2AuthorizationContext`.
289
+
This can be useful when you need to supply an `OAuth2AuthorizedClientProvider` with required (supported) attribute(s), eg. the `PasswordOAuth2AuthorizedClientProvider` requires the resource owner's `username` and `password` to be available in `OAuth2AuthorizationContext.getAttributes()`.
290
+
291
+
The following code shows an example of the `contextAttributesMapper`:
292
+
293
+
[source,java]
294
+
----
295
+
@Bean
296
+
public OAuth2AuthorizedClientManager authorizedClientManager(
0 commit comments