Skip to content

Commit cb5f985

Browse files
committed
Reorganize ref doc sections for oauth2-client
Fixes gh-7428
1 parent 810e4cb commit cb5f985

File tree

1 file changed

+54
-37
lines changed

1 file changed

+54
-37
lines changed

docs/manual/src/docs/asciidoc/_includes/servlet/preface/oauth2-client.adoc

Lines changed: 54 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@ The following sections go into more detail on each of the configuration options
4444
* <<oauth2Client-authorized-repo-service>>
4545
* <<oauth2Client-authorized-manager-provider>>
4646
* <<oauth2Client-registered-authorized-client>>
47-
* <<oauth2Client-authorization-request-repository>>
48-
* <<oauth2Client-authorization-request-resolver>>
49-
* <<oauth2Client-access-token-client>>
47+
48+
49+
[[oauth2Client-core-interface-class]]
50+
=== Core Interfaces / Classes
5051

5152

5253
[[oauth2Client-client-registration]]
53-
=== ClientRegistration
54+
==== ClientRegistration
5455

5556
`ClientRegistration` is a representation of a client registered with an OAuth 2.0 or OpenID Connect 1.0 Provider.
5657

@@ -112,7 +113,7 @@ The supported values are *header*, *form* and *query*.
112113

113114

114115
[[oauth2Client-client-registration-repo]]
115-
=== ClientRegistrationRepository
116+
==== ClientRegistrationRepository
116117

117118
The `ClientRegistrationRepository` serves as a repository for OAuth 2.0 / OpenID Connect 1.0 `ClientRegistration`(s).
118119

@@ -151,7 +152,7 @@ public class OAuth2ClientController {
151152

152153

153154
[[oauth2Client-authorized-client]]
154-
=== OAuth2AuthorizedClient
155+
==== OAuth2AuthorizedClient
155156

156157
`OAuth2AuthorizedClient` is a representation of an Authorized Client.
157158
A client is considered to be authorized when the end-user (Resource Owner) has granted authorization to the client to access its protected resources.
@@ -160,7 +161,7 @@ A client is considered to be authorized when the end-user (Resource Owner) has g
160161

161162

162163
[[oauth2Client-authorized-repo-service]]
163-
=== OAuth2AuthorizedClientRepository / OAuth2AuthorizedClientService
164+
==== OAuth2AuthorizedClientRepository / OAuth2AuthorizedClientService
164165

165166
`OAuth2AuthorizedClientRepository` is responsible for persisting `OAuth2AuthorizedClient`(s) between web requests.
166167
Whereas, the primary role of `OAuth2AuthorizedClientService` is to manage `OAuth2AuthorizedClient`(s) at the application-level.
@@ -202,7 +203,7 @@ public class OAuth2LoginController {
202203

203204

204205
[[oauth2Client-authorized-manager-provider]]
205-
=== OAuth2AuthorizedClientManager / OAuth2AuthorizedClientProvider
206+
==== OAuth2AuthorizedClientManager / OAuth2AuthorizedClientProvider
206207

207208
The `OAuth2AuthorizedClientManager` is responsible for the overall management of `OAuth2AuthorizedClient`(s).
208209

@@ -248,37 +249,20 @@ Spring Boot 2.x auto-configuration registers an `OAuth2AuthorizedClientManager`
248249
However, the application may choose to override and register a custom `OAuth2AuthorizedClientManager` `@Bean`.
249250

250251

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) {
264-
OAuth2AccessToken accessToken = authorizedClient.getAccessToken();
252+
[[oauth2Client-auth-grant-support]]
253+
=== Authorization Grant Support
265254

266-
...
267255

268-
return "userinfo";
269-
}
270-
}
271-
----
256+
[[oauth2Client-auth-code-grant]]
257+
==== Authorization Code
272258

273-
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.
274261

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`
278262

263+
===== Obtaining Authorization
279264

280-
[[oauth2Client-authorization-request-repository]]
281-
=== AuthorizationRequestRepository
265+
`AuthorizationRequestRepository`
282266

283267
`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).
284268

@@ -314,8 +298,7 @@ public class OAuth2ClientSecurityConfig extends WebSecurityConfigurerAdapter {
314298
----
315299

316300

317-
[[oauth2Client-authorization-request-resolver]]
318-
=== OAuth2AuthorizationRequestResolver
301+
`OAuth2AuthorizationRequestResolver`
319302

320303
The primary role of the `OAuth2AuthorizationRequestResolver` is to resolve an `OAuth2AuthorizationRequest` from the provided web request.
321304
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`.
@@ -438,8 +421,9 @@ private OAuth2AuthorizationRequest customAuthorizationRequest(
438421
----
439422

440423

441-
[[oauth2Client-access-token-client]]
442-
=== OAuth2AccessTokenResponseClient
424+
===== Requesting an Access Token
425+
426+
`OAuth2AccessTokenResponseClient`
443427

444428
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.
445429

@@ -498,3 +482,36 @@ public class OAuth2ClientSecurityConfig extends WebSecurityConfigurerAdapter {
498482
}
499483
}
500484
----
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) {
504+
OAuth2AccessToken accessToken = authorizedClient.getAccessToken();
505+
506+
...
507+
508+
return "userinfo";
509+
}
510+
}
511+
----
512+
513+
The `@RegisteredOAuth2AuthorizedClient` annotation is handled by `OAuth2AuthorizedClientArgumentResolver` and provides the following capabilities:
514+
515+
* An `OAuth2AccessToken` will automatically be requested if the client has not yet been authorized.
516+
** For `authorization_code`, this involves triggering the authorization request redirect to initiate the flow
517+
** For `client_credentials`, the access token is directly obtained from the Token Endpoint using `DefaultClientCredentialsTokenResponseClient`

0 commit comments

Comments
 (0)