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
The `OAuth2AuthorizedClientManager` is responsible for the overall management of `OAuth2AuthorizedClient`(s).
208
209
@@ -248,37 +249,20 @@ Spring Boot 2.x auto-configuration registers an `OAuth2AuthorizedClientManager`
248
249
However, the application may choose to override and register a custom `OAuth2AuthorizedClientManager` `@Bean`.
249
250
250
251
251
-
[[oauth2Client-registered-authorized-client]]
252
-
=== RegisteredOAuth2AuthorizedClient
253
-
254
-
The `@RegisteredOAuth2AuthorizedClient` annotation provides the capability of resolving a method parameter to an argument value of type `OAuth2AuthorizedClient`.
255
-
This is a convenient alternative compared to looking up the `OAuth2AuthorizedClient` via the `OAuth2AuthorizedClientService`.
256
-
257
-
[source,java]
258
-
----
259
-
@Controller
260
-
public class OAuth2LoginController {
261
-
262
-
@RequestMapping("/userinfo")
263
-
public String userinfo(@RegisteredOAuth2AuthorizedClient("google") OAuth2AuthorizedClient authorizedClient) {
The `@RegisteredOAuth2AuthorizedClient` annotation is handled by `OAuth2AuthorizedClientArgumentResolver` and provides the following capabilities:
259
+
[.lead]
260
+
Please refer to the OAuth 2.0 Authorization Framework for further details on the https://tools.ietf.org/html/rfc6749#section-1.3.1[Authorization Code] grant.
274
261
275
-
* An `OAuth2AccessToken` will automatically be requested if the client has not yet been authorized.
276
-
** For `authorization_code`, this involves triggering the authorization request redirect to initiate the flow
277
-
** For `client_credentials`, the access token is directly obtained from the Token Endpoint using `DefaultClientCredentialsTokenResponseClient`
278
262
263
+
===== Obtaining Authorization
279
264
280
-
[[oauth2Client-authorization-request-repository]]
281
-
=== AuthorizationRequestRepository
265
+
`AuthorizationRequestRepository`
282
266
283
267
`AuthorizationRequestRepository` is responsible for the persistence of the `OAuth2AuthorizationRequest` from the time the Authorization Request is initiated to the time the Authorization Response is received (the callback).
284
268
@@ -314,8 +298,7 @@ public class OAuth2ClientSecurityConfig extends WebSecurityConfigurerAdapter {
314
298
----
315
299
316
300
317
-
[[oauth2Client-authorization-request-resolver]]
318
-
=== OAuth2AuthorizationRequestResolver
301
+
`OAuth2AuthorizationRequestResolver`
319
302
320
303
The primary role of the `OAuth2AuthorizationRequestResolver` is to resolve an `OAuth2AuthorizationRequest` from the provided web request.
321
304
The default implementation `DefaultOAuth2AuthorizationRequestResolver` matches on the (default) path `/oauth2/authorization/{registrationId}` extracting the `registrationId` and using it to build the `OAuth2AuthorizationRequest` for the associated `ClientRegistration`.
The primary role of the `OAuth2AccessTokenResponseClient` is to exchange an authorization grant credential for an access token credential at the Authorization Server's Token Endpoint.
445
429
@@ -498,3 +482,36 @@ public class OAuth2ClientSecurityConfig extends WebSecurityConfigurerAdapter {
498
482
}
499
483
}
500
484
----
485
+
486
+
487
+
[[oauth2Client-additional-features]]
488
+
=== Additional Features
489
+
490
+
491
+
[[oauth2Client-registered-authorized-client]]
492
+
==== RegisteredOAuth2AuthorizedClient
493
+
494
+
The `@RegisteredOAuth2AuthorizedClient` annotation provides the capability of resolving a method parameter to an argument value of type `OAuth2AuthorizedClient`.
495
+
This is a convenient alternative compared to looking up the `OAuth2AuthorizedClient` via the `OAuth2AuthorizedClientService`.
496
+
497
+
[source,java]
498
+
----
499
+
@Controller
500
+
public class OAuth2LoginController {
501
+
502
+
@RequestMapping("/userinfo")
503
+
public String userinfo(@RegisteredOAuth2AuthorizedClient("google") OAuth2AuthorizedClient authorizedClient) {
0 commit comments