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/modules/ROOT/pages/reactive/oauth2/client/authorized-clients.adoc
+11-10Lines changed: 11 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,10 @@
1
-
[[oauth2Client-additional-features]]
2
-
= Authorized Clients
1
+
[[oauth2-client-additional-features]]
2
+
= [[oauth2Client-additional-features]]Authorized Client Features
3
3
4
+
This section covers additional features provided by Spring Security for OAuth2 Client.
4
5
5
-
[[oauth2Client-registered-authorized-client]]
6
-
== Resolving an Authorized Client
6
+
[[oauth2-client-registered-authorized-client]]
7
+
== [[oauth2Client-registered-authorized-client]]Resolving an Authorized Client
7
8
8
9
The `@RegisteredOAuth2AuthorizedClient` annotation provides the capability of resolving a method parameter to an argument value of type `OAuth2AuthorizedClient`.
9
10
This is a convenient alternative compared to accessing the `OAuth2AuthorizedClient` using the `ReactiveOAuth2AuthorizedClientManager` or `ReactiveOAuth2AuthorizedClientService`.
@@ -42,16 +43,15 @@ class OAuth2ClientController {
42
43
----
43
44
======
44
45
45
-
The `@RegisteredOAuth2AuthorizedClient` annotation is handled by `OAuth2AuthorizedClientArgumentResolver`, which directly uses a <<oauth2Client-authorized-manager-provider, ReactiveOAuth2AuthorizedClientManager>> and therefore inherits it's capabilities.
46
+
The `@RegisteredOAuth2AuthorizedClient` annotation is handled by `OAuth2AuthorizedClientArgumentResolver`, which directly uses a xref:reactive/oauth2/client/core.adoc#oauth2Client-authorized-manager-provider[ReactiveOAuth2AuthorizedClientManager] and therefore inherits it's capabilities.
46
47
47
-
48
-
[[oauth2Client-webclient-webflux]]
49
-
== WebClient integration for Reactive Environments
48
+
[[oauth2-client-web-client]]
49
+
== [[oauth2Client-webclient-webflux]]WebClient integration for Reactive Environments
50
50
51
51
The OAuth 2.0 Client support integrates with `WebClient` using an `ExchangeFilterFunction`.
52
52
53
53
The `ServerOAuth2AuthorizedClientExchangeFilterFunction` provides a simple mechanism for requesting protected resources by using an `OAuth2AuthorizedClient` and including the associated `OAuth2AccessToken` as a Bearer Token.
54
-
It directly uses an <<oauth2Client-authorized-manager-provider, ReactiveOAuth2AuthorizedClientManager>> and therefore inherits the following capabilities:
54
+
It directly uses an xref:reactive/oauth2/client/core.adoc#oauth2Client-authorized-manager-provider[ReactiveOAuth2AuthorizedClientManager] and therefore inherits the following capabilities:
55
55
56
56
* An `OAuth2AccessToken` will be requested if the client has not yet been authorized.
57
57
** `authorization_code` - triggers the Authorization Request redirect to initiate the flow
@@ -91,6 +91,7 @@ fun webClient(authorizedClientManager: ReactiveOAuth2AuthorizedClientManager): W
91
91
----
92
92
======
93
93
94
+
[[oauth2-client-web-client-authorized-client]]
94
95
=== Providing the Authorized Client
95
96
96
97
The `ServerOAuth2AuthorizedClientExchangeFilterFunction` determines the client to use (for a request) by resolving the `OAuth2AuthorizedClient` from the `ClientRequest.attributes()` (request attributes).
@@ -184,7 +185,7 @@ fun index(): Mono<String> {
184
185
======
185
186
<1> `clientRegistrationId()` is a `static` method in `ServerOAuth2AuthorizedClientExchangeFilterFunction`.
If neither `OAuth2AuthorizedClient` or `ClientRegistration.getRegistrationId()` is provided as a request attribute, the `ServerOAuth2AuthorizedClientExchangeFilterFunction` can determine the _default_ client to use depending on it's configuration.
Client Authentication with client credentials included in the request-body is supported out of the box and no customization is necessary to enable it.
@@ -76,8 +78,8 @@ spring:
76
78
...
77
79
----
78
80
79
-
[[oauth2Client-jwt-bearer-auth]]
80
-
== JWT Bearer
81
+
[[oauth2-client-authentication-jwt-bearer]]
82
+
== [[oauth2Client-jwt-bearer-auth]]JWT Bearer
81
83
82
84
[NOTE]
83
85
Please refer to JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants for further details on https://datatracker.ietf.org/doc/html/rfc7523#section-2.2[JWT Bearer] Client Authentication.
@@ -89,7 +91,7 @@ a signed JSON Web Token (JWS) in the `client_assertion` parameter.
89
91
The `java.security.PrivateKey` or `javax.crypto.SecretKey` used for signing the JWS
90
92
is supplied by the `com.nimbusds.jose.jwk.JWK` resolver associated with `NimbusJwtClientAuthenticationParametersConverter`.
The JWT produced by `NimbusJwtClientAuthenticationParametersConverter` contains the `iss`, `sub`, `aud`, `jti`, `iat` and `exp` claims by default. You can customize the headers and/or claims by providing a `Consumer<NimbusJwtClientAuthenticationParametersConverter.JwtClientAuthenticationContext<T>>` to `setJwtClientAssertionCustomizer()`. The following example shows how to customize claims of the JWT:
0 commit comments