From 0c0af48fea5cdd7c87b685cf417ad4e691aeea56 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 31 Mar 2025 12:58:44 +0100 Subject: [PATCH] Create spring-boot-security-oauth2-resource-server module --- settings.gradle | 1 + .../build.gradle | 1 + ...anagementWebSecurityAutoConfiguration.java | 8 ++--- ...anagementWebSecurityAutoConfiguration.java | 8 ++--- ...mentWebSecurityAutoConfigurationTests.java | 2 +- ...mentWebSecurityAutoConfigurationTests.java | 2 +- .../build.gradle | 1 + ...2AuthorizationServerAutoConfiguration.java | 4 +-- ...itional-spring-configuration-metadata.json | 8 ----- ...ot.autoconfigure.AutoConfiguration.imports | 2 -- .../spring-boot-dependencies/build.gradle | 1 + .../spring-boot-docs/build.gradle | 2 ++ .../build.gradle | 30 +++++++++++++++++++ ...ConditionalOnIssuerLocationJwtDecoder.java | 5 ++-- .../ConditionalOnPublicKeyJwtDecoder.java | 5 ++-- .../autoconfigure}/IssuerUriCondition.java | 8 ++--- .../autoconfigure}/KeyValueCondition.java | 8 ++--- .../OAuth2ResourceServerProperties.java | 4 +-- .../resource/autoconfigure}/package-info.java | 4 +-- ...riReactiveJwtDecoderBuilderCustomizer.java | 6 ++-- ...OAuth2ResourceServerAutoConfiguration.java | 6 ++-- ...tiveOAuth2ResourceServerConfiguration.java | 4 +-- ...eOAuth2ResourceServerJwkConfiguration.java | 8 ++--- ...esourceServerOpaqueTokenConfiguration.java | 4 +-- .../autoconfigure}/reactive/package-info.java | 4 +-- .../JwkSetUriJwtDecoderBuilderCustomizer.java | 6 ++-- ...OAuth2ResourceServerAutoConfiguration.java | 11 +++---- .../OAuth2ResourceServerJwtConfiguration.java | 8 ++--- ...esourceServerOpaqueTokenConfiguration.java | 4 +-- .../Oauth2ResourceServerConfiguration.java | 4 +-- .../autoconfigure}/servlet/package-info.java | 4 +-- ...itional-spring-configuration-metadata.json | 13 ++++++++ ...ot.autoconfigure.AutoConfiguration.imports | 2 ++ ...verterCustomizationsArgumentsProvider.java | 4 +-- ...2ResourceServerAutoConfigurationTests.java | 4 +-- ...2ResourceServerAutoConfigurationTests.java | 4 +-- .../build.gradle | 3 +- .../build.gradle | 1 + ...eactive.AutoConfigureWebTestClient.imports | 2 +- ...e.web.servlet.AutoConfigureMockMvc.imports | 2 +- ...TestAutoConfigurationIntegrationTests.java | 2 +- ...TestAutoConfigurationIntegrationTests.java | 2 +- 42 files changed, 120 insertions(+), 92 deletions(-) create mode 100644 spring-boot-project/spring-boot-security-oauth2-resource-server/build.gradle rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/ConditionalOnIssuerLocationJwtDecoder.java (91%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/ConditionalOnPublicKeyJwtDecoder.java (91%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/IssuerUriCondition.java (85%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/KeyValueCondition.java (87%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/OAuth2ResourceServerProperties.java (98%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/package-info.java (82%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/reactive/JwkSetUriReactiveJwtDecoderBuilderCustomizer.java (88%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/reactive/ReactiveOAuth2ResourceServerAutoConfiguration.java (90%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/reactive/ReactiveOAuth2ResourceServerConfiguration.java (93%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/reactive/ReactiveOAuth2ResourceServerJwkConfiguration.java (96%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/reactive/ReactiveOAuth2ResourceServerOpaqueTokenConfiguration.java (93%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/reactive/package-info.java (81%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/servlet/JwkSetUriJwtDecoderBuilderCustomizer.java (88%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/servlet/OAuth2ResourceServerAutoConfiguration.java (76%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/servlet/OAuth2ResourceServerJwtConfiguration.java (95%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/servlet/OAuth2ResourceServerOpaqueTokenConfiguration.java (93%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/servlet/Oauth2ResourceServerConfiguration.java (92%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/servlet/package-info.java (81%) create mode 100644 spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/resources/META-INF/additional-spring-configuration-metadata.json create mode 100644 spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports rename spring-boot-project/{spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/test/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/JwtConverterCustomizationsArgumentsProvider.java (97%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/test/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/reactive/ReactiveOAuth2ResourceServerAutoConfigurationTests.java (99%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource => spring-boot-security-oauth2-resource-server/src/test/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure}/servlet/OAuth2ResourceServerAutoConfigurationTests.java (99%) diff --git a/settings.gradle b/settings.gradle index 821f7eefda..f049307586 100644 --- a/settings.gradle +++ b/settings.gradle @@ -102,6 +102,7 @@ include "spring-boot-project:spring-boot-reactor-netty" include "spring-boot-project:spring-boot-rsocket" include "spring-boot-project:spring-boot-security" include "spring-boot-project:spring-boot-security-oauth2-client" +include "spring-boot-project:spring-boot-security-oauth2-resource-server" include "spring-boot-project:spring-boot-sendgrid" include "spring-boot-project:spring-boot-test" include "spring-boot-project:spring-boot-test-autoconfigure" diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle b/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle index 4a1d4cb81c..722c380413 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle @@ -49,6 +49,7 @@ dependencies { optional(project(":spring-boot-project:spring-boot-r2dbc")) optional(project(":spring-boot-project:spring-boot-reactor-netty")) optional(project(":spring-boot-project:spring-boot-security-oauth2-client")) + optional(project(":spring-boot-project:spring-boot-security-oauth2-resource-server")) optional(project(":spring-boot-project:spring-boot-tomcat")) optional(project(":spring-boot-project:spring-boot-undertow")) optional(project(":spring-boot-project:spring-boot-validation")) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfiguration.java index e10d445d17..b6c9252ac3 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfiguration.java @@ -28,7 +28,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.boot.autoconfigure.security.oauth2.resource.reactive.ReactiveOAuth2ResourceServerAutoConfiguration; import org.springframework.boot.security.autoconfigure.reactive.ReactiveSecurityAutoConfiguration; import org.springframework.boot.security.autoconfigure.reactive.ReactiveUserDetailsServiceAutoConfiguration; import org.springframework.context.annotation.Bean; @@ -56,9 +55,10 @@ import static org.springframework.security.config.Customizer.withDefaults; */ @AutoConfiguration(before = ReactiveSecurityAutoConfiguration.class, after = { HealthEndpointAutoConfiguration.class, InfoEndpointAutoConfiguration.class, - WebEndpointAutoConfiguration.class, ReactiveOAuth2ResourceServerAutoConfiguration.class, - ReactiveUserDetailsServiceAutoConfiguration.class }, - afterName = "org.springframework.boot.security.oauth2.client.autoconfigure.reactive.ReactiveOAuth2ClientWebSecurityAutoConfiguration") + WebEndpointAutoConfiguration.class, ReactiveUserDetailsServiceAutoConfiguration.class }, + afterName = { + "org.springframework.boot.security.oauth2.client.autoconfigure.reactive.ReactiveOAuth2ClientWebSecurityAutoConfiguration", + "org.springframework.boot.security.oauth2.server.resource.autoconfigure.reactive.ReactiveOAuth2ResourceServerAutoConfiguration" }) @ConditionalOnClass({ EnableWebFluxSecurity.class, WebFilterChainProxy.class }) @ConditionalOnMissingBean({ SecurityWebFilterChain.class, WebFilterChainProxy.class }) @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfiguration.java index cd7274686d..0982f30245 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfiguration.java @@ -16,7 +16,6 @@ package org.springframework.boot.actuate.autoconfigure.security.servlet; -import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.health.HealthEndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.info.InfoEndpointAutoConfiguration; import org.springframework.boot.actuate.endpoint.web.WebServerNamespace; @@ -24,7 +23,6 @@ import org.springframework.boot.actuate.health.HealthEndpoint; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration; import org.springframework.boot.security.autoconfigure.ConditionalOnDefaultWebSecurity; import org.springframework.boot.security.autoconfigure.SecurityProperties; import org.springframework.boot.security.autoconfigure.servlet.SecurityAutoConfiguration; @@ -50,10 +48,10 @@ import static org.springframework.security.config.Customizer.withDefaults; * @since 2.1.0 */ @AutoConfiguration(before = SecurityAutoConfiguration.class, - after = { HealthEndpointAutoConfiguration.class, InfoEndpointAutoConfiguration.class, - WebEndpointAutoConfiguration.class, OAuth2ResourceServerAutoConfiguration.class }, + after = { HealthEndpointAutoConfiguration.class, InfoEndpointAutoConfiguration.class }, afterName = { "org.springframework.boot.security.autoconfigure.saml2.Saml2RelyingPartyAutoConfiguration", - "org.springframework.boot.security.oauth2.client.autoconfigure.servlet.OAuth2ClientWebSecurityAutoConfiguration" }) + "org.springframework.boot.security.oauth2.client.autoconfigure.servlet.OAuth2ClientWebSecurityAutoConfiguration", + "org.springframework.boot.security.oauth2.server.resource.autoconfigure.servlet.OAuth2ResourceServerAutoConfiguration" }) @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @ConditionalOnDefaultWebSecurity public class ManagementWebSecurityAutoConfiguration { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfigurationTests.java index 2fe4699593..f52614abe4 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfigurationTests.java @@ -31,9 +31,9 @@ import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAu import org.springframework.boot.actuate.autoconfigure.health.HealthEndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.info.InfoEndpointAutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.autoconfigure.security.oauth2.resource.reactive.ReactiveOAuth2ResourceServerAutoConfiguration; import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration; import org.springframework.boot.security.autoconfigure.reactive.ReactiveSecurityAutoConfiguration; +import org.springframework.boot.security.oauth2.server.resource.autoconfigure.reactive.ReactiveOAuth2ResourceServerAutoConfiguration; import org.springframework.boot.test.context.assertj.AssertableReactiveWebApplicationContext; import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner; import org.springframework.context.ApplicationContext; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java index c22b7a7822..1612bb4cdb 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java @@ -29,10 +29,10 @@ import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAu import org.springframework.boot.actuate.autoconfigure.health.HealthEndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.info.InfoEndpointAutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration; import org.springframework.boot.security.autoconfigure.SecurityProperties; import org.springframework.boot.security.autoconfigure.saml2.Saml2RelyingPartyAutoConfiguration; import org.springframework.boot.security.autoconfigure.servlet.SecurityAutoConfiguration; +import org.springframework.boot.security.oauth2.server.resource.autoconfigure.servlet.OAuth2ResourceServerAutoConfiguration; import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext; import org.springframework.boot.test.context.runner.WebApplicationContextRunner; diff --git a/spring-boot-project/spring-boot-autoconfigure-all/build.gradle b/spring-boot-project/spring-boot-autoconfigure-all/build.gradle index 3c3e74120d..9eebd2c28f 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/build.gradle +++ b/spring-boot-project/spring-boot-autoconfigure-all/build.gradle @@ -56,6 +56,7 @@ dependencies { optional(project(":spring-boot-project:spring-boot-reactor-netty")) optional(project(":spring-boot-project:spring-boot-rsocket")) optional(project(":spring-boot-project:spring-boot-security")) + optional(project(":spring-boot-project:spring-boot-security-oauth2-resource-server")) optional(project(":spring-boot-project:spring-boot-tomcat")) optional(project(":spring-boot-project:spring-boot-tx")) optional(project(":spring-boot-project:spring-boot-validation")) diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/server/servlet/OAuth2AuthorizationServerAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/server/servlet/OAuth2AuthorizationServerAutoConfiguration.java index 61d3f4fc39..84750a3e99 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/server/servlet/OAuth2AuthorizationServerAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/server/servlet/OAuth2AuthorizationServerAutoConfiguration.java @@ -20,7 +20,6 @@ import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration; import org.springframework.boot.security.autoconfigure.servlet.UserDetailsServiceAutoConfiguration; import org.springframework.context.annotation.Import; import org.springframework.security.oauth2.server.authorization.OAuth2Authorization; @@ -41,8 +40,7 @@ import org.springframework.security.oauth2.server.authorization.OAuth2Authorizat * @since 3.1.0 * @see OAuth2AuthorizationServerJwtAutoConfiguration */ -@AutoConfiguration(before = OAuth2ResourceServerAutoConfiguration.class, beforeName = { - "org.springframework.boot.security.autoconfigure.servlet.SecurityAutoConfiguration", +@AutoConfiguration(beforeName = { "org.springframework.boot.security.autoconfigure.servlet.SecurityAutoConfiguration", "org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration" }) @ConditionalOnClass(OAuth2Authorization.class) @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/additional-spring-configuration-metadata.json index a01892e467..c9895e9498 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -454,14 +454,6 @@ "level": "error" } }, - { - "name": "spring.security.oauth2.resourceserver.jwt.jws-algorithm", - "type": "java.lang.String", - "deprecation": { - "replacement": "spring.security.oauth2.resourceserver.jwt.jws-algorithms", - "level": "error" - } - }, { "name": "spring.servlet.encoding.enabled", "type": "java.lang.Boolean", diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 3dc7d9449c..30259a7ccf 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -18,8 +18,6 @@ org.springframework.boot.autoconfigure.http.client.reactive.service.ReactiveHttp org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration org.springframework.boot.autoconfigure.netty.NettyAutoConfiguration org.springframework.boot.autoconfigure.reactor.ReactorAutoConfiguration -org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration -org.springframework.boot.autoconfigure.security.oauth2.resource.reactive.ReactiveOAuth2ResourceServerAutoConfiguration org.springframework.boot.autoconfigure.security.oauth2.server.servlet.OAuth2AuthorizationServerAutoConfiguration org.springframework.boot.autoconfigure.security.oauth2.server.servlet.OAuth2AuthorizationServerJwtAutoConfiguration org.springframework.boot.autoconfigure.session.SessionAutoConfiguration diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index ed811a8854..cd6da64d3d 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -2039,6 +2039,7 @@ bom { "spring-boot-rsocket", "spring-boot-security", "spring-boot-security-oauth2-client", + "spring-boot-security-oauth2-resource-server", "spring-boot-sendgrid", "spring-boot-starter", "spring-boot-starter-activemq", diff --git a/spring-boot-project/spring-boot-docs/build.gradle b/spring-boot-project/spring-boot-docs/build.gradle index ed1fae65ca..b0851d1acb 100644 --- a/spring-boot-project/spring-boot-docs/build.gradle +++ b/spring-boot-project/spring-boot-docs/build.gradle @@ -113,6 +113,7 @@ dependencies { autoConfiguration(project(path: ":spring-boot-project:spring-boot-rsocket", configuration: "autoConfigurationMetadata")) autoConfiguration(project(path: ":spring-boot-project:spring-boot-security", configuration: "autoConfigurationMetadata")) autoConfiguration(project(path: ":spring-boot-project:spring-boot-security-oauth2-client", configuration: "autoConfigurationMetadata")) + autoConfiguration(project(path: ":spring-boot-project:spring-boot-security-oauth2-resource-server", configuration: "autoConfigurationMetadata")) autoConfiguration(project(path: ":spring-boot-project:spring-boot-sendgrid", configuration: "autoConfigurationMetadata")) autoConfiguration(project(path: ":spring-boot-project:spring-boot-testcontainers", configuration: "autoConfigurationMetadata")) autoConfiguration(project(path: ":spring-boot-project:spring-boot-thymeleaf", configuration: "autoConfigurationMetadata")) @@ -178,6 +179,7 @@ dependencies { configurationProperties(project(path: ":spring-boot-project:spring-boot-rsocket", configuration: "configurationPropertiesMetadata")) configurationProperties(project(path: ":spring-boot-project:spring-boot-security", configuration: "configurationPropertiesMetadata")) configurationProperties(project(path: ":spring-boot-project:spring-boot-security-oauth2-client", configuration: "configurationPropertiesMetadata")) + configurationProperties(project(path: ":spring-boot-project:spring-boot-security-oauth2-resource-server", configuration: "configurationPropertiesMetadata")) configurationProperties(project(path: ":spring-boot-project:spring-boot-sendgrid", configuration: "configurationPropertiesMetadata")) configurationProperties(project(path: ":spring-boot-project:spring-boot-test-autoconfigure", configuration: "configurationPropertiesMetadata")) configurationProperties(project(path: ":spring-boot-project:spring-boot-testcontainers", configuration: "configurationPropertiesMetadata")) diff --git a/spring-boot-project/spring-boot-security-oauth2-resource-server/build.gradle b/spring-boot-project/spring-boot-security-oauth2-resource-server/build.gradle new file mode 100644 index 0000000000..8f38fe2f12 --- /dev/null +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/build.gradle @@ -0,0 +1,30 @@ +plugins { + id "java-library" + id "org.springframework.boot.auto-configuration" + id "org.springframework.boot.configuration-properties" + id "org.springframework.boot.deployed" + id "org.springframework.boot.optional-dependencies" +} + +description = "Spring Boot Security OAuth2 Resource Server" + +dependencies { + api(project(":spring-boot-project:spring-boot")) + api("org.springframework.security:spring-security-oauth2-jose") + api("org.springframework.security:spring-security-oauth2-resource-server") + + implementation(project(":spring-boot-project:spring-boot-security")) + + optional(project(":spring-boot-project:spring-boot-autoconfigure")) + optional("io.projectreactor:reactor-core") + optional("jakarta.servlet:jakarta.servlet-api") + + testImplementation(project(":spring-boot-project:spring-boot-test")) + testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support")) + testImplementation(project(":spring-boot-project:spring-boot-webmvc")) + testImplementation("com.fasterxml.jackson.core:jackson-databind") + testImplementation("com.squareup.okhttp3:mockwebserver") + + testRuntimeOnly("ch.qos.logback:logback-classic") + testRuntimeOnly("org.springframework:spring-webflux") +} diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ConditionalOnIssuerLocationJwtDecoder.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/ConditionalOnIssuerLocationJwtDecoder.java similarity index 91% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ConditionalOnIssuerLocationJwtDecoder.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/ConditionalOnIssuerLocationJwtDecoder.java index 2a8b8fe29c..02299167e5 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ConditionalOnIssuerLocationJwtDecoder.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/ConditionalOnIssuerLocationJwtDecoder.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; @@ -30,9 +30,8 @@ import org.springframework.security.oauth2.jwt.NimbusJwtDecoder; * issuer-location-based JWT decoder} should be used. * * @author Andy Wilkinson - * @since 3.5.0 + * @since 4.0.0 */ -@SuppressWarnings("removal") @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE, ElementType.METHOD }) @Documented diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ConditionalOnPublicKeyJwtDecoder.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/ConditionalOnPublicKeyJwtDecoder.java similarity index 91% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ConditionalOnPublicKeyJwtDecoder.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/ConditionalOnPublicKeyJwtDecoder.java index ef54bd0127..eec69c6a12 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ConditionalOnPublicKeyJwtDecoder.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/ConditionalOnPublicKeyJwtDecoder.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; @@ -30,9 +30,8 @@ import org.springframework.security.oauth2.jwt.NimbusJwtDecoder; * JWT decoder} should be used. * * @author Andy Wilkinson - * @since 3.5.0 + * @since 4.0.0 */ -@SuppressWarnings("removal") @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE, ElementType.METHOD }) @Documented diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/IssuerUriCondition.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/IssuerUriCondition.java similarity index 85% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/IssuerUriCondition.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/IssuerUriCondition.java index 688710b615..71457bb4ee 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/IssuerUriCondition.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/IssuerUriCondition.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure; import org.springframework.boot.autoconfigure.condition.ConditionMessage; import org.springframework.boot.autoconfigure.condition.ConditionOutcome; @@ -29,12 +29,8 @@ import org.springframework.util.StringUtils; * Condition for creating {@link JwtDecoder} by oidc issuer location. * * @author Artsiom Yudovin - * @since 2.1.0 - * @deprecated since 3.5.0 for removal in 4.0.0 in favor of - * {@link ConditionalOnIssuerLocationJwtDecoder @ConditionalOnIssuerLocationJwtDecoder} */ -@Deprecated(since = "3.5.0", forRemoval = true) -public class IssuerUriCondition extends SpringBootCondition { +class IssuerUriCondition extends SpringBootCondition { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/KeyValueCondition.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/KeyValueCondition.java similarity index 87% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/KeyValueCondition.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/KeyValueCondition.java index e245484055..3c28b517f2 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/KeyValueCondition.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/KeyValueCondition.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure; import org.springframework.boot.autoconfigure.condition.ConditionMessage; import org.springframework.boot.autoconfigure.condition.ConditionOutcome; @@ -28,12 +28,8 @@ import org.springframework.util.StringUtils; * Condition for creating a jwt decoder using a public key value. * * @author Madhura Bhave - * @since 2.2.0 - * @deprecated since 3.5.0 for removal in 4.0.0 in favor of - * {@link ConditionalOnPublicKeyJwtDecoder @ConditionalOnPublicKeyJwtDecoder} */ -@Deprecated(since = "3.5.0", forRemoval = true) -public class KeyValueCondition extends SpringBootCondition { +class KeyValueCondition extends SpringBootCondition { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/OAuth2ResourceServerProperties.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/OAuth2ResourceServerProperties.java similarity index 98% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/OAuth2ResourceServerProperties.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/OAuth2ResourceServerProperties.java index 665e55658e..a3a6f0c9e1 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/OAuth2ResourceServerProperties.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/OAuth2ResourceServerProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure; import java.io.IOException; import java.io.InputStream; @@ -35,7 +35,7 @@ import org.springframework.util.StreamUtils; * @author Artsiom Yudovin * @author Mushtaq Ahmed * @author Yan Kardziyaka - * @since 2.1.0 + * @since 4.0.0 */ @ConfigurationProperties("spring.security.oauth2.resourceserver") public class OAuth2ResourceServerProperties { diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/package-info.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/package-info.java similarity index 82% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/package-info.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/package-info.java index 734023bce5..a3567ff3ee 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/package-info.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,4 +17,4 @@ /** * Support for Spring Security's OAuth2 resource server. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure; diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/JwkSetUriReactiveJwtDecoderBuilderCustomizer.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/JwkSetUriReactiveJwtDecoderBuilderCustomizer.java similarity index 88% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/JwkSetUriReactiveJwtDecoderBuilderCustomizer.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/JwkSetUriReactiveJwtDecoderBuilderCustomizer.java index 8905e4e494..6cba90d152 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/JwkSetUriReactiveJwtDecoderBuilderCustomizer.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/JwkSetUriReactiveJwtDecoderBuilderCustomizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource.reactive; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure.reactive; import org.springframework.security.oauth2.jwt.NimbusReactiveJwtDecoder.JwkSetUriReactiveJwtDecoderBuilder; import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder; @@ -26,7 +26,7 @@ import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder; * obtained through an issuer URI. * * @author Andy Wilkinson - * @since 3.1.0 + * @since 4.0.0 */ @FunctionalInterface public interface JwkSetUriReactiveJwtDecoderBuilderCustomizer { diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerAutoConfiguration.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/ReactiveOAuth2ResourceServerAutoConfiguration.java similarity index 90% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerAutoConfiguration.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/ReactiveOAuth2ResourceServerAutoConfiguration.java index c0939dbdad..f9cfd6bd4e 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerAutoConfiguration.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/ReactiveOAuth2ResourceServerAutoConfiguration.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource.reactive; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure.reactive; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.boot.autoconfigure.security.oauth2.resource.OAuth2ResourceServerProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.security.autoconfigure.reactive.ReactiveSecurityAutoConfiguration; import org.springframework.boot.security.autoconfigure.reactive.ReactiveUserDetailsServiceAutoConfiguration; +import org.springframework.boot.security.oauth2.server.resource.autoconfigure.OAuth2ResourceServerProperties; import org.springframework.context.annotation.Import; import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; @@ -32,7 +32,7 @@ import org.springframework.security.config.annotation.web.reactive.EnableWebFlux * support. * * @author Madhura Bhave - * @since 2.1.0 + * @since 4.0.0 */ @AutoConfiguration( before = { ReactiveSecurityAutoConfiguration.class, ReactiveUserDetailsServiceAutoConfiguration.class }) diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerConfiguration.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/ReactiveOAuth2ResourceServerConfiguration.java similarity index 93% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerConfiguration.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/ReactiveOAuth2ResourceServerConfiguration.java index 7429a8bc40..5a3c6e4ed5 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerConfiguration.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/ReactiveOAuth2ResourceServerConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource.reactive; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure.reactive; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.context.annotation.Configuration; diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerJwkConfiguration.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/ReactiveOAuth2ResourceServerJwkConfiguration.java similarity index 96% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerJwkConfiguration.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/ReactiveOAuth2ResourceServerJwkConfiguration.java index 2dbbb1476c..e0069b728a 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerJwkConfiguration.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/ReactiveOAuth2ResourceServerJwkConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource.reactive; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure.reactive; import java.security.KeyFactory; import java.security.interfaces.RSAPublicKey; @@ -30,10 +30,10 @@ import org.springframework.boot.autoconfigure.condition.AnyNestedCondition; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.autoconfigure.security.oauth2.resource.ConditionalOnIssuerLocationJwtDecoder; -import org.springframework.boot.autoconfigure.security.oauth2.resource.ConditionalOnPublicKeyJwtDecoder; -import org.springframework.boot.autoconfigure.security.oauth2.resource.OAuth2ResourceServerProperties; import org.springframework.boot.context.properties.PropertyMapper; +import org.springframework.boot.security.oauth2.server.resource.autoconfigure.ConditionalOnIssuerLocationJwtDecoder; +import org.springframework.boot.security.oauth2.server.resource.autoconfigure.ConditionalOnPublicKeyJwtDecoder; +import org.springframework.boot.security.oauth2.server.resource.autoconfigure.OAuth2ResourceServerProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerOpaqueTokenConfiguration.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/ReactiveOAuth2ResourceServerOpaqueTokenConfiguration.java similarity index 93% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerOpaqueTokenConfiguration.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/ReactiveOAuth2ResourceServerOpaqueTokenConfiguration.java index 20cd99f57d..fdfa198fee 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerOpaqueTokenConfiguration.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/ReactiveOAuth2ResourceServerOpaqueTokenConfiguration.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource.reactive; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure.reactive; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.autoconfigure.security.oauth2.resource.OAuth2ResourceServerProperties; +import org.springframework.boot.security.oauth2.server.resource.autoconfigure.OAuth2ResourceServerProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.web.server.ServerHttpSecurity; diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/package-info.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/package-info.java similarity index 81% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/package-info.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/package-info.java index a99fe8a06d..b50ca5a7f0 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/package-info.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,4 +17,4 @@ /** * Auto-configuration for Spring Security's Reactive OAuth2 resource server. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource.reactive; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure.reactive; diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/JwkSetUriJwtDecoderBuilderCustomizer.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/JwkSetUriJwtDecoderBuilderCustomizer.java similarity index 88% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/JwkSetUriJwtDecoderBuilderCustomizer.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/JwkSetUriJwtDecoderBuilderCustomizer.java index fd42e0a55b..428f256f8c 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/JwkSetUriJwtDecoderBuilderCustomizer.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/JwkSetUriJwtDecoderBuilderCustomizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource.servlet; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure.servlet; import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.security.oauth2.jwt.NimbusJwtDecoder.JwkSetUriJwtDecoderBuilder; @@ -25,7 +25,7 @@ import org.springframework.security.oauth2.jwt.NimbusJwtDecoder.JwkSetUriJwtDeco * configured directly or obtained through an issuer URI. * * @author Andy Wilkinson - * @since 3.1.0 + * @since 4.0.0 */ @FunctionalInterface public interface JwkSetUriJwtDecoderBuilderCustomizer { diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfiguration.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/OAuth2ResourceServerAutoConfiguration.java similarity index 76% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfiguration.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/OAuth2ResourceServerAutoConfiguration.java index 365e1a80d8..8853be11c5 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfiguration.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/OAuth2ResourceServerAutoConfiguration.java @@ -14,14 +14,16 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource.servlet; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure.servlet; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.boot.autoconfigure.security.oauth2.resource.OAuth2ResourceServerProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.security.autoconfigure.servlet.SecurityAutoConfiguration; +import org.springframework.boot.security.autoconfigure.servlet.UserDetailsServiceAutoConfiguration; +import org.springframework.boot.security.oauth2.server.resource.autoconfigure.OAuth2ResourceServerProperties; import org.springframework.context.annotation.Import; import org.springframework.security.oauth2.server.resource.authentication.BearerTokenAuthenticationToken; @@ -29,10 +31,9 @@ import org.springframework.security.oauth2.server.resource.authentication.Bearer * {@link EnableAutoConfiguration Auto-configuration} for OAuth2 resource server support. * * @author Madhura Bhave - * @since 2.1.0 + * @since 4.0.0 */ -@AutoConfiguration(beforeName = { "org.springframework.boot.security.autoconfigure.servlet.SecurityAutoConfiguration", - "org.springframework.boot.security.autoconfigure.servlet.UserDetailsServiceAutoConfiguration" }) +@AutoConfiguration(before = { SecurityAutoConfiguration.class, UserDetailsServiceAutoConfiguration.class }) @EnableConfigurationProperties(OAuth2ResourceServerProperties.class) @ConditionalOnClass(BearerTokenAuthenticationToken.class) @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerJwtConfiguration.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/OAuth2ResourceServerJwtConfiguration.java similarity index 95% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerJwtConfiguration.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/OAuth2ResourceServerJwtConfiguration.java index 9b64e51864..726c6ac3ca 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerJwtConfiguration.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/OAuth2ResourceServerJwtConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource.servlet; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure.servlet; import java.security.KeyFactory; import java.security.interfaces.RSAPublicKey; @@ -30,11 +30,11 @@ import org.springframework.boot.autoconfigure.condition.AnyNestedCondition; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.autoconfigure.security.oauth2.resource.ConditionalOnIssuerLocationJwtDecoder; -import org.springframework.boot.autoconfigure.security.oauth2.resource.ConditionalOnPublicKeyJwtDecoder; -import org.springframework.boot.autoconfigure.security.oauth2.resource.OAuth2ResourceServerProperties; import org.springframework.boot.context.properties.PropertyMapper; import org.springframework.boot.security.autoconfigure.ConditionalOnDefaultWebSecurity; +import org.springframework.boot.security.oauth2.server.resource.autoconfigure.ConditionalOnIssuerLocationJwtDecoder; +import org.springframework.boot.security.oauth2.server.resource.autoconfigure.ConditionalOnPublicKeyJwtDecoder; +import org.springframework.boot.security.oauth2.server.resource.autoconfigure.OAuth2ResourceServerProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerOpaqueTokenConfiguration.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/OAuth2ResourceServerOpaqueTokenConfiguration.java similarity index 93% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerOpaqueTokenConfiguration.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/OAuth2ResourceServerOpaqueTokenConfiguration.java index 0c122a818c..4de805e6ab 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerOpaqueTokenConfiguration.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/OAuth2ResourceServerOpaqueTokenConfiguration.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource.servlet; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure.servlet; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.autoconfigure.security.oauth2.resource.OAuth2ResourceServerProperties; import org.springframework.boot.security.autoconfigure.ConditionalOnDefaultWebSecurity; +import org.springframework.boot.security.oauth2.server.resource.autoconfigure.OAuth2ResourceServerProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/Oauth2ResourceServerConfiguration.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/Oauth2ResourceServerConfiguration.java similarity index 92% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/Oauth2ResourceServerConfiguration.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/Oauth2ResourceServerConfiguration.java index 6a323bdd6e..56a77a3937 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/Oauth2ResourceServerConfiguration.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/Oauth2ResourceServerConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource.servlet; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure.servlet; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.context.annotation.Configuration; diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/package-info.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/package-info.java similarity index 81% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/package-info.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/package-info.java index 43110b9821..5b25b876a5 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/package-info.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,4 +17,4 @@ /** * Auto-configuration for Spring Security's OAuth2 resource server. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource.servlet; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure.servlet; diff --git a/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..ccbb1dd449 --- /dev/null +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,13 @@ +{ + "groups": [], + "properties": [ + { + "name": "spring.security.oauth2.resourceserver.jwt.jws-algorithm", + "type": "java.lang.String", + "deprecation": { + "replacement": "spring.security.oauth2.resourceserver.jwt.jws-algorithms", + "level": "error" + } + } + ] +} diff --git a/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..36abf455cc --- /dev/null +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,2 @@ +org.springframework.boot.security.oauth2.server.resource.autoconfigure.reactive.ReactiveOAuth2ResourceServerAutoConfiguration +org.springframework.boot.security.oauth2.server.resource.autoconfigure.servlet.OAuth2ResourceServerAutoConfiguration diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/JwtConverterCustomizationsArgumentsProvider.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/test/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/JwtConverterCustomizationsArgumentsProvider.java similarity index 97% rename from spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/JwtConverterCustomizationsArgumentsProvider.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/test/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/JwtConverterCustomizationsArgumentsProvider.java index 7ef5d20fa9..2f6658030b 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/JwtConverterCustomizationsArgumentsProvider.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/test/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/JwtConverterCustomizationsArgumentsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure; import java.time.Instant; import java.util.UUID; diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerAutoConfigurationTests.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/test/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/ReactiveOAuth2ResourceServerAutoConfigurationTests.java similarity index 99% rename from spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerAutoConfigurationTests.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/test/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/ReactiveOAuth2ResourceServerAutoConfigurationTests.java index 600c44db89..3e581d8353 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/test/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/reactive/ReactiveOAuth2ResourceServerAutoConfigurationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource.reactive; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure.reactive; import java.io.IOException; import java.lang.annotation.ElementType; @@ -49,7 +49,7 @@ import org.mockito.InOrder; import reactor.core.publisher.Mono; import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.autoconfigure.security.oauth2.resource.JwtConverterCustomizationsArgumentsProvider; +import org.springframework.boot.security.oauth2.server.resource.autoconfigure.JwtConverterCustomizationsArgumentsProvider; import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.assertj.AssertableReactiveWebApplicationContext; import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner; diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfigurationTests.java b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/test/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/OAuth2ResourceServerAutoConfigurationTests.java similarity index 99% rename from spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfigurationTests.java rename to spring-boot-project/spring-boot-security-oauth2-resource-server/src/test/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/OAuth2ResourceServerAutoConfigurationTests.java index 55e9f13e94..e9476c545c 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-security-oauth2-resource-server/src/test/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/OAuth2ResourceServerAutoConfigurationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.security.oauth2.resource.servlet; +package org.springframework.boot.security.oauth2.server.resource.autoconfigure.servlet; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; @@ -47,7 +47,7 @@ import org.junit.jupiter.params.provider.ArgumentsSource; import org.mockito.InOrder; import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.autoconfigure.security.oauth2.resource.JwtConverterCustomizationsArgumentsProvider; +import org.springframework.boot.security.oauth2.server.resource.autoconfigure.JwtConverterCustomizationsArgumentsProvider; import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext; import org.springframework.boot.test.context.runner.WebApplicationContextRunner; diff --git a/spring-boot-project/spring-boot-starters/spring-boot-starter-oauth2-resource-server/build.gradle b/spring-boot-project/spring-boot-starters/spring-boot-starter-oauth2-resource-server/build.gradle index 88f114f3cb..30df4aa658 100644 --- a/spring-boot-project/spring-boot-starters/spring-boot-starter-oauth2-resource-server/build.gradle +++ b/spring-boot-project/spring-boot-starters/spring-boot-starter-oauth2-resource-server/build.gradle @@ -6,6 +6,5 @@ description = "Starter for using Spring Security's OAuth2 resource server featur dependencies { api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-security")) - api("org.springframework.security:spring-security-oauth2-resource-server") - api("org.springframework.security:spring-security-oauth2-jose") + api(project(":spring-boot-project:spring-boot-security-oauth2-resource-server")) } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/build.gradle b/spring-boot-project/spring-boot-test-autoconfigure/build.gradle index 02418828cf..c71a595676 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/build.gradle +++ b/spring-boot-project/spring-boot-test-autoconfigure/build.gradle @@ -64,6 +64,7 @@ dependencies { optional(project(":spring-boot-project:spring-boot-reactor-netty")) optional(project(":spring-boot-project:spring-boot-security")) optional(project(":spring-boot-project:spring-boot-security-oauth2-client")) + optional(project(":spring-boot-project:spring-boot-security-oauth2-resource-server")) optional(project(":spring-boot-project:spring-boot-tx")) optional(project(":spring-boot-project:spring-boot-validation")) optional(project(":spring-boot-project:spring-boot-webmvc")) diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient.imports b/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient.imports index 7a88bbcf1e..0c619da2da 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient.imports +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient.imports @@ -3,5 +3,5 @@ optional:org.springframework.boot.security.autoconfigure.reactive.ReactiveSecuri optional:org.springframework.boot.security.autoconfigure.reactive.ReactiveUserDetailsServiceAutoConfiguration optional:org.springframework.boot.security.oauth2.client.autoconfigure.reactive.ReactiveOAuth2ClientAutoConfiguration optional:org.springframework.boot.security.oauth2.client.autoconfigure.reactive.ReactiveOAuth2ClientWebSecurityAutoConfiguration -org.springframework.boot.autoconfigure.security.oauth2.resource.reactive.ReactiveOAuth2ResourceServerAutoConfiguration +optional:org.springframework.boot.security.oauth2.server.resource.autoconfigure.reactive.ReactiveOAuth2ResourceServerAutoConfiguration org.springframework.boot.test.autoconfigure.web.reactive.WebTestClientAutoConfiguration \ No newline at end of file diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc.imports b/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc.imports index 2c97434a90..37ef6688a2 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc.imports +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc.imports @@ -4,10 +4,10 @@ optional:org.springframework.boot.security.autoconfigure.servlet.SecurityFilterA optional:org.springframework.boot.security.autoconfigure.servlet.UserDetailsServiceAutoConfiguration optional:org.springframework.boot.security.oauth2.client.autoconfigure.OAuth2ClientAutoConfiguration optional:org.springframework.boot.security.oauth2.client.autoconfigure.servlet.OAuth2ClientWebSecurityAutoConfiguration +optional:org.springframework.boot.security.oauth2.server.resource.autoconfigure.servlet.OAuth2ResourceServerAutoConfiguration org.springframework.boot.test.autoconfigure.web.servlet.MockMvcAutoConfiguration org.springframework.boot.test.autoconfigure.web.servlet.MockMvcWebClientAutoConfiguration org.springframework.boot.test.autoconfigure.web.servlet.MockMvcWebDriverAutoConfiguration -org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration org.springframework.boot.autoconfigure.security.saml2.Saml2RelyingPartyAutoConfiguration org.springframework.boot.test.autoconfigure.web.servlet.MockMvcSecurityConfiguration org.springframework.boot.test.autoconfigure.web.reactive.WebTestClientAutoConfiguration \ No newline at end of file diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebFluxTestAutoConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebFluxTestAutoConfigurationIntegrationTests.java index ab9348a54c..11018e9fb0 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebFluxTestAutoConfigurationIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebFluxTestAutoConfigurationIntegrationTests.java @@ -20,11 +20,11 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration; -import org.springframework.boot.autoconfigure.security.oauth2.resource.reactive.ReactiveOAuth2ResourceServerAutoConfiguration; import org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration; import org.springframework.boot.freemarker.autoconfigure.FreeMarkerAutoConfiguration; import org.springframework.boot.mustache.autoconfigure.MustacheAutoConfiguration; import org.springframework.boot.security.oauth2.client.autoconfigure.reactive.ReactiveOAuth2ClientAutoConfiguration; +import org.springframework.boot.security.oauth2.server.resource.autoconfigure.reactive.ReactiveOAuth2ResourceServerAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest; import org.springframework.boot.thymeleaf.autoconfigure.ThymeleafAutoConfiguration; import org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration; diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTestAutoConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTestAutoConfigurationIntegrationTests.java index e4c3f2064b..630e83f357 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTestAutoConfigurationIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTestAutoConfigurationIntegrationTests.java @@ -19,13 +19,13 @@ package org.springframework.boot.test.autoconfigure.web.servlet; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration; import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration; import org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration; import org.springframework.boot.freemarker.autoconfigure.FreeMarkerAutoConfiguration; import org.springframework.boot.groovy.template.autoconfigure.GroovyTemplateAutoConfiguration; import org.springframework.boot.mustache.autoconfigure.MustacheAutoConfiguration; import org.springframework.boot.security.oauth2.client.autoconfigure.OAuth2ClientAutoConfiguration; +import org.springframework.boot.security.oauth2.server.resource.autoconfigure.servlet.OAuth2ResourceServerAutoConfiguration; import org.springframework.boot.thymeleaf.autoconfigure.ThymeleafAutoConfiguration; import org.springframework.context.ApplicationContext; import org.springframework.core.task.AsyncTaskExecutor;