Skip to content

Commit 912a8a8

Browse files
committed
Create spring-boot-security-oauth2-client module
1 parent 6777573 commit 912a8a8

File tree

34 files changed

+93
-60
lines changed

34 files changed

+93
-60
lines changed

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ include "spring-boot-project:spring-boot-r2dbc"
101101
include "spring-boot-project:spring-boot-reactor-netty"
102102
include "spring-boot-project:spring-boot-rsocket"
103103
include "spring-boot-project:spring-boot-security"
104+
include "spring-boot-project:spring-boot-security-oauth2-client"
104105
include "spring-boot-project:spring-boot-sendgrid"
105106
include "spring-boot-project:spring-boot-test"
106107
include "spring-boot-project:spring-boot-test-autoconfigure"

spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ dependencies {
4848
optional(project(":spring-boot-project:spring-boot-quartz"))
4949
optional(project(":spring-boot-project:spring-boot-r2dbc"))
5050
optional(project(":spring-boot-project:spring-boot-reactor-netty"))
51+
optional(project(":spring-boot-project:spring-boot-security-oauth2-client"))
5152
optional(project(":spring-boot-project:spring-boot-tomcat"))
5253
optional(project(":spring-boot-project:spring-boot-undertow"))
5354
optional(project(":spring-boot-project:spring-boot-validation"))

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfiguration.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
2929
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
3030
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
31-
import org.springframework.boot.autoconfigure.security.oauth2.client.reactive.ReactiveOAuth2ClientAutoConfiguration;
3231
import org.springframework.boot.autoconfigure.security.oauth2.resource.reactive.ReactiveOAuth2ResourceServerAutoConfiguration;
3332
import org.springframework.boot.security.autoconfigure.reactive.ReactiveSecurityAutoConfiguration;
3433
import org.springframework.boot.security.autoconfigure.reactive.ReactiveUserDetailsServiceAutoConfiguration;
@@ -57,9 +56,9 @@
5756
*/
5857
@AutoConfiguration(before = ReactiveSecurityAutoConfiguration.class,
5958
after = { HealthEndpointAutoConfiguration.class, InfoEndpointAutoConfiguration.class,
60-
WebEndpointAutoConfiguration.class, ReactiveOAuth2ClientAutoConfiguration.class,
61-
ReactiveOAuth2ResourceServerAutoConfiguration.class,
62-
ReactiveUserDetailsServiceAutoConfiguration.class })
59+
WebEndpointAutoConfiguration.class, ReactiveOAuth2ResourceServerAutoConfiguration.class,
60+
ReactiveUserDetailsServiceAutoConfiguration.class },
61+
afterName = "org.springframework.boot.security.oauth2.client.autoconfigure.reactive.ReactiveOAuth2ClientAutoConfiguration")
6362
@ConditionalOnClass({ EnableWebFluxSecurity.class, WebFilterChainProxy.class })
6463
@ConditionalOnMissingBean({ SecurityWebFilterChain.class, WebFilterChainProxy.class })
6564
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfiguration.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.springframework.boot.autoconfigure.AutoConfiguration;
2525
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
2626
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
27-
import org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientAutoConfiguration;
2827
import org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration;
2928
import org.springframework.boot.security.autoconfigure.ConditionalOnDefaultWebSecurity;
3029
import org.springframework.boot.security.autoconfigure.SecurityProperties;
@@ -52,9 +51,9 @@
5251
*/
5352
@AutoConfiguration(before = SecurityAutoConfiguration.class,
5453
after = { HealthEndpointAutoConfiguration.class, InfoEndpointAutoConfiguration.class,
55-
WebEndpointAutoConfiguration.class, OAuth2ClientAutoConfiguration.class,
56-
OAuth2ResourceServerAutoConfiguration.class },
57-
afterName = "org.springframework.boot.security.autoconfigure.saml2.Saml2RelyingPartyAutoConfiguration")
54+
WebEndpointAutoConfiguration.class, OAuth2ResourceServerAutoConfiguration.class },
55+
afterName = { "org.springframework.boot.security.autoconfigure.saml2.Saml2RelyingPartyAutoConfiguration",
56+
"org.springframework.boot.security.oauth2.client.autoconfigure.servlet.OAuth2ClientAutoConfiguration" })
5857
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
5958
@ConditionalOnDefaultWebSecurity
6059
public class ManagementWebSecurityAutoConfiguration {

spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ org.springframework.boot.autoconfigure.http.client.HttpClientAutoConfiguration
1515
org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration
1616
org.springframework.boot.autoconfigure.netty.NettyAutoConfiguration
1717
org.springframework.boot.autoconfigure.reactor.ReactorAutoConfiguration
18-
org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientAutoConfiguration
19-
org.springframework.boot.autoconfigure.security.oauth2.client.reactive.ReactiveOAuth2ClientAutoConfiguration
2018
org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration
2119
org.springframework.boot.autoconfigure.security.oauth2.resource.reactive.ReactiveOAuth2ResourceServerAutoConfiguration
2220
org.springframework.boot.autoconfigure.security.oauth2.server.servlet.OAuth2AuthorizationServerAutoConfiguration

spring-boot-project/spring-boot-dependencies/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,6 +2048,7 @@ bom {
20482048
"spring-boot-reactor-netty",
20492049
"spring-boot-rsocket",
20502050
"spring-boot-security",
2051+
"spring-boot-security-oauth2-client",
20512052
"spring-boot-sendgrid",
20522053
"spring-boot-starter",
20532054
"spring-boot-starter-activemq",

spring-boot-project/spring-boot-docs/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ dependencies {
106106
autoConfiguration(project(path: ":spring-boot-project:spring-boot-reactor-netty", configuration: "autoConfigurationMetadata"))
107107
autoConfiguration(project(path: ":spring-boot-project:spring-boot-rsocket", configuration: "autoConfigurationMetadata"))
108108
autoConfiguration(project(path: ":spring-boot-project:spring-boot-security", configuration: "autoConfigurationMetadata"))
109+
autoConfiguration(project(path: ":spring-boot-project:spring-boot-security-oauth2-client", configuration: "autoConfigurationMetadata"))
109110
autoConfiguration(project(path: ":spring-boot-project:spring-boot-sendgrid", configuration: "autoConfigurationMetadata"))
110111
autoConfiguration(project(path: ":spring-boot-project:spring-boot-testcontainers", configuration: "autoConfigurationMetadata"))
111112
autoConfiguration(project(path: ":spring-boot-project:spring-boot-thymeleaf", configuration: "autoConfigurationMetadata"))
@@ -170,6 +171,7 @@ dependencies {
170171
configurationProperties(project(path: ":spring-boot-project:spring-boot-reactor-netty", configuration: "configurationPropertiesMetadata"))
171172
configurationProperties(project(path: ":spring-boot-project:spring-boot-rsocket", configuration: "configurationPropertiesMetadata"))
172173
configurationProperties(project(path: ":spring-boot-project:spring-boot-security", configuration: "configurationPropertiesMetadata"))
174+
configurationProperties(project(path: ":spring-boot-project:spring-boot-security-oauth2-client", configuration: "configurationPropertiesMetadata"))
173175
configurationProperties(project(path: ":spring-boot-project:spring-boot-sendgrid", configuration: "configurationPropertiesMetadata"))
174176
configurationProperties(project(path: ":spring-boot-project:spring-boot-test-autoconfigure", configuration: "configurationPropertiesMetadata"))
175177
configurationProperties(project(path: ":spring-boot-project:spring-boot-testcontainers", configuration: "configurationPropertiesMetadata"))

spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/web/spring-security.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ https://oauth.net/2/[OAuth2] is a widely used authorization framework that is su
9595
=== Client
9696

9797
If you have `spring-security-oauth2-client` on your classpath, you can take advantage of some auto-configuration to set up OAuth2/Open ID Connect clients.
98-
This configuration makes use of the properties under javadoc:org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties[].
98+
This configuration makes use of the properties under javadoc:org.springframework.boot.security.oauth2.client.autoconfigure.OAuth2ClientProperties[].
9999
The same properties are applicable to both servlet and reactive applications.
100100

101101
You can register multiple OAuth2 clients and providers under the `spring.security.oauth2.client` prefix, as shown in the following example:
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
plugins {
2+
id "java-library"
3+
id "org.springframework.boot.auto-configuration"
4+
id "org.springframework.boot.configuration-properties"
5+
id "org.springframework.boot.deployed"
6+
id "org.springframework.boot.optional-dependencies"
7+
}
8+
9+
description = "Spring Boot Security OAuth2 Client"
10+
11+
dependencies {
12+
api(project(":spring-boot-project:spring-boot"))
13+
api("org.springframework.security:spring-security-oauth2-client")
14+
15+
implementation(project(":spring-boot-project:spring-boot-security"))
16+
17+
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
18+
optional("io.projectreactor:reactor-core")
19+
20+
testImplementation(project(":spring-boot-project:spring-boot-test"))
21+
testImplementation(project(":spring-boot-project:spring-boot-tomcat"))
22+
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
23+
testImplementation(project(":spring-boot-project:spring-boot-webmvc"))
24+
testImplementation("com.fasterxml.jackson.core:jackson-databind")
25+
testImplementation("com.squareup.okhttp3:mockwebserver")
26+
27+
testRuntimeOnly("ch.qos.logback:logback-classic")
28+
testRuntimeOnly("org.springframework:spring-webflux")
29+
}

spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/ClientsConfiguredCondition.java renamed to spring-boot-project/spring-boot-security-oauth2-client/src/main/java/org/springframework/boot/security/oauth2/client/autoconfigure/ClientsConfiguredCondition.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.security.oauth2.client;
17+
package org.springframework.boot.security.oauth2.client.autoconfigure;
1818

1919
import java.util.Collections;
2020
import java.util.Map;
@@ -34,12 +34,8 @@
3434
* properties are defined.
3535
*
3636
* @author Madhura Bhave
37-
* @since 2.1.0
38-
* @deprecated since 3.5.0 for removal in 3.7.0 in favor of
39-
* {@link ConditionalOnOAuth2ClientRegistrationProperties @ConditionalOnOAuth2ClientRegistrationConfigured}
4037
*/
41-
@Deprecated(since = "3.5.0", forRemoval = true)
42-
public class ClientsConfiguredCondition extends SpringBootCondition {
38+
class ClientsConfiguredCondition extends SpringBootCondition {
4339

4440
private static final Bindable<Map<String, OAuth2ClientProperties.Registration>> STRING_REGISTRATION_MAP = Bindable
4541
.mapOf(String.class, OAuth2ClientProperties.Registration.class);

0 commit comments

Comments
 (0)