Skip to content

Commit 6a324c2

Browse files
committed
Document OAuth 2.0 Client XML Support
Fixes gh-8074
1 parent dfa7880 commit 6a324c2

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

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

+41-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,27 @@ class OAuth2ClientSecurityConfig : WebSecurityConfigurerAdapter() {
6868
----
6969
====
7070

71+
In addition to the `HttpSecurity.oauth2Client()` DSL, XML configuration is also supported.
72+
73+
The following code shows the complete configuration options available in the <<nsa-oauth2-client, security namespace>>:
74+
75+
.OAuth2 Client XML Configuration Options
76+
====
77+
[source,xml]
78+
----
79+
<http>
80+
<oauth2-client client-registration-repository-ref="clientRegistrationRepository"
81+
authorized-client-repository-ref="authorizedClientRepository"
82+
authorized-client-service-ref="authorizedClientService">
83+
<authorization-code-grant
84+
authorization-request-repository-ref="authorizationRequestRepository"
85+
authorization-request-resolver-ref="authorizationRequestResolver"
86+
access-token-response-client-ref="accessTokenResponseClient"/>
87+
</oauth2-client>
88+
</http>
89+
----
90+
====
91+
7192
The `OAuth2AuthorizedClientManager` is responsible for managing the authorization (or re-authorization) of an OAuth 2.0 Client, in collaboration with one or more `OAuth2AuthorizedClientProvider`(s).
7293

7394
The following code shows an example of how to register an `OAuth2AuthorizedClientManager` `@Bean` and associate it with an `OAuth2AuthorizedClientProvider` composite that provides support for the `authorization_code`, `refresh_token`, `client_credentials` and `password` authorization grant types:
@@ -655,8 +676,17 @@ class OAuth2ClientSecurityConfig : WebSecurityConfigurerAdapter() {
655676
}
656677
}
657678
----
658-
====
659679
680+
.Xml
681+
[source,xml,role="secondary"]
682+
----
683+
<http>
684+
<oauth2-client>
685+
<authorization-code-grant authorization-request-repository-ref="authorizationRequestRepository"/>
686+
</oauth2-client>
687+
</http>
688+
----
689+
====
660690

661691
===== Requesting an Access Token
662692

@@ -739,6 +769,16 @@ class OAuth2ClientSecurityConfig : WebSecurityConfigurerAdapter() {
739769
}
740770
}
741771
----
772+
773+
.Xml
774+
[source,xml,role="secondary"]
775+
----
776+
<http>
777+
<oauth2-client>
778+
<authorization-code-grant access-token-response-client-ref="accessTokenResponseClient"/>
779+
</oauth2-client>
780+
</http>
781+
----
742782
====
743783

744784

0 commit comments

Comments
 (0)