From 4ce8b591e07fc8ed48736a3f16826ee1a15943e4 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 31 Mar 2025 15:07:32 +0100 Subject: [PATCH] Create spring-boot-security-saml2 module --- settings.gradle | 1 + .../build.gradle | 9 +++++ ...anagementWebSecurityAutoConfiguration.java | 5 +-- ...mentWebSecurityAutoConfigurationTests.java | 2 +- .../spring-boot-docs/build.gradle | 2 ++ .../spring-boot-security-saml2/build.gradle | 35 +++++++++++++++++++ .../RegistrationConfiguredCondition.java | 4 +-- .../Saml2LoginConfiguration.java | 2 +- .../Saml2RelyingPartyAutoConfiguration.java | 2 +- .../Saml2RelyingPartyProperties.java | 2 +- ...RelyingPartyRegistrationConfiguration.java | 12 +++---- .../saml2/autoconfigure}/package-info.java | 2 +- ...itional-spring-configuration-metadata.json | 4 +++ ...ot.autoconfigure.AutoConfiguration.imports | 1 + ...ml2RelyingPartyAutoConfigurationTests.java | 6 ++-- .../Saml2RelyingPartyPropertiesTests.java | 2 +- .../saml2/autoconfigure}/certificate-location | 0 .../saml2/autoconfigure}/idp-metadata | 0 .../idp-metadata-with-multiple-providers | 0 .../saml2/autoconfigure}/private-key-location | 0 .../security/saml2/autoconfigure}/rsa.crt | 0 .../security/saml2/autoconfigure}/rsa.key | 0 .../spring-boot-security/build.gradle | 2 +- ...ot.autoconfigure.AutoConfiguration.imports | 1 - .../build.gradle | 17 ++++----- ...e.web.servlet.AutoConfigureMockMvc.imports | 2 +- .../build.gradle | 2 +- 27 files changed, 84 insertions(+), 31 deletions(-) create mode 100644 spring-boot-project/spring-boot-security-saml2/build.gradle rename spring-boot-project/{spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2 => spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure}/RegistrationConfiguredCondition.java (95%) rename spring-boot-project/{spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2 => spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure}/Saml2LoginConfiguration.java (96%) rename spring-boot-project/{spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2 => spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure}/Saml2RelyingPartyAutoConfiguration.java (96%) rename spring-boot-project/{spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2 => spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure}/Saml2RelyingPartyProperties.java (99%) rename spring-boot-project/{spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2 => spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure}/Saml2RelyingPartyRegistrationConfiguration.java (96%) rename spring-boot-project/{spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2 => spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure}/package-info.java (91%) create mode 100644 spring-boot-project/spring-boot-security-saml2/src/main/resources/META-INF/additional-spring-configuration-metadata.json create mode 100644 spring-boot-project/spring-boot-security-saml2/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports rename spring-boot-project/{spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/saml2 => spring-boot-security-saml2/src/test/java/org/springframework/boot/security/saml2/autoconfigure}/Saml2RelyingPartyAutoConfigurationTests.java (99%) rename spring-boot-project/{spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/saml2 => spring-boot-security-saml2/src/test/java/org/springframework/boot/security/saml2/autoconfigure}/Saml2RelyingPartyPropertiesTests.java (98%) rename spring-boot-project/{spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2 => spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure}/certificate-location (100%) rename spring-boot-project/{spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2 => spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure}/idp-metadata (100%) rename spring-boot-project/{spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2 => spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure}/idp-metadata-with-multiple-providers (100%) rename spring-boot-project/{spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2 => spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure}/private-key-location (100%) rename spring-boot-project/{spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2 => spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure}/rsa.crt (100%) rename spring-boot-project/{spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2 => spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure}/rsa.key (100%) diff --git a/settings.gradle b/settings.gradle index b41c33a9ad..65d651a67e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -104,6 +104,7 @@ include "spring-boot-project:spring-boot-security" include "spring-boot-project:spring-boot-security-oauth2-authorization-server" 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-security-saml2" 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 722c380413..6668a9bfba 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle @@ -9,6 +9,14 @@ plugins { description = "Spring Boot Actuator AutoConfigure" +configurations.all { + resolutionStrategy.eachDependency { + if (it.requested.group == 'org.opensaml') { + it.useVersion '4.0.1' + } + } +} + dependencies { api(project(":spring-boot-project:spring-boot-actuator")) api(project(":spring-boot-project:spring-boot-all")) @@ -50,6 +58,7 @@ dependencies { 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-security-saml2")) 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/servlet/ManagementWebSecurityAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfiguration.java index 0982f30245..23f27620ac 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 @@ -49,9 +49,10 @@ import static org.springframework.security.config.Customizer.withDefaults; */ @AutoConfiguration(before = SecurityAutoConfiguration.class, after = { HealthEndpointAutoConfiguration.class, InfoEndpointAutoConfiguration.class }, - afterName = { "org.springframework.boot.security.autoconfigure.saml2.Saml2RelyingPartyAutoConfiguration", + afterName = { "org.springframework.boot.security.oauth2.client.autoconfigure.servlet.OAuth2ClientWebSecurityAutoConfiguration", - "org.springframework.boot.security.oauth2.server.resource.autoconfigure.servlet.OAuth2ResourceServerAutoConfiguration" }) + "org.springframework.boot.security.oauth2.server.resource.autoconfigure.servlet.OAuth2ResourceServerAutoConfiguration", + "org.springframework.boot.security.saml2.autoconfigure.Saml2RelyingPartyAutoConfiguration" }) @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/servlet/ManagementWebSecurityAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java index 1612bb4cdb..12e799b447 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 @@ -30,9 +30,9 @@ import org.springframework.boot.actuate.autoconfigure.health.HealthEndpointAutoC import org.springframework.boot.actuate.autoconfigure.info.InfoEndpointAutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigurations; 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.security.saml2.autoconfigure.Saml2RelyingPartyAutoConfiguration; 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-docs/build.gradle b/spring-boot-project/spring-boot-docs/build.gradle index 4890660221..186e9e537f 100644 --- a/spring-boot-project/spring-boot-docs/build.gradle +++ b/spring-boot-project/spring-boot-docs/build.gradle @@ -115,6 +115,7 @@ dependencies { autoConfiguration(project(path: ":spring-boot-project:spring-boot-security-oauth2-authorization-server", 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-security-saml2", 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")) @@ -182,6 +183,7 @@ dependencies { configurationProperties(project(path: ":spring-boot-project:spring-boot-security-oauth2-authorization-server", 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-security-saml2", 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-saml2/build.gradle b/spring-boot-project/spring-boot-security-saml2/build.gradle new file mode 100644 index 0000000000..f973f1fd3d --- /dev/null +++ b/spring-boot-project/spring-boot-security-saml2/build.gradle @@ -0,0 +1,35 @@ +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 SAML2" + +configurations.all { + resolutionStrategy.eachDependency { + if (it.requested.group == 'org.opensaml') { + it.useVersion '4.0.1' + } + } +} + +dependencies { + api(project(":spring-boot-project:spring-boot")) + api("org.springframework.security:spring-security-saml2-service-provider") + + implementation(project(":spring-boot-project:spring-boot-security")) + + optional(project(":spring-boot-project:spring-boot-autoconfigure")) + + 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") + testImplementation("jakarta.servlet:jakarta.servlet-api") + + testRuntimeOnly("ch.qos.logback:logback-classic") +} diff --git a/spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/RegistrationConfiguredCondition.java b/spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/RegistrationConfiguredCondition.java similarity index 95% rename from spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/RegistrationConfiguredCondition.java rename to spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/RegistrationConfiguredCondition.java index 2263711646..4756553f7d 100644 --- a/spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/RegistrationConfiguredCondition.java +++ b/spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/RegistrationConfiguredCondition.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.security.autoconfigure.saml2; +package org.springframework.boot.security.saml2.autoconfigure; import java.util.Collections; import java.util.Map; @@ -24,7 +24,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.SpringBootCondition; import org.springframework.boot.context.properties.bind.Bindable; import org.springframework.boot.context.properties.bind.Binder; -import org.springframework.boot.security.autoconfigure.saml2.Saml2RelyingPartyProperties.Registration; +import org.springframework.boot.security.saml2.autoconfigure.Saml2RelyingPartyProperties.Registration; import org.springframework.context.annotation.ConditionContext; import org.springframework.core.env.Environment; import org.springframework.core.type.AnnotatedTypeMetadata; diff --git a/spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/Saml2LoginConfiguration.java b/spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/Saml2LoginConfiguration.java similarity index 96% rename from spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/Saml2LoginConfiguration.java rename to spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/Saml2LoginConfiguration.java index 939559656b..5024182e3b 100644 --- a/spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/Saml2LoginConfiguration.java +++ b/spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/Saml2LoginConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.security.autoconfigure.saml2; +package org.springframework.boot.security.saml2.autoconfigure; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.security.autoconfigure.ConditionalOnDefaultWebSecurity; diff --git a/spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/Saml2RelyingPartyAutoConfiguration.java b/spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/Saml2RelyingPartyAutoConfiguration.java similarity index 96% rename from spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/Saml2RelyingPartyAutoConfiguration.java rename to spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/Saml2RelyingPartyAutoConfiguration.java index d30a85cc5a..2eef79e1f9 100644 --- a/spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/Saml2RelyingPartyAutoConfiguration.java +++ b/spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/Saml2RelyingPartyAutoConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.security.autoconfigure.saml2; +package org.springframework.boot.security.saml2.autoconfigure; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; diff --git a/spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/Saml2RelyingPartyProperties.java b/spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/Saml2RelyingPartyProperties.java similarity index 99% rename from spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/Saml2RelyingPartyProperties.java rename to spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/Saml2RelyingPartyProperties.java index 8ef3da9265..a42f9c093a 100644 --- a/spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/Saml2RelyingPartyProperties.java +++ b/spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/Saml2RelyingPartyProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.security.autoconfigure.saml2; +package org.springframework.boot.security.saml2.autoconfigure; import java.util.ArrayList; import java.util.LinkedHashMap; diff --git a/spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/Saml2RelyingPartyRegistrationConfiguration.java b/spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/Saml2RelyingPartyRegistrationConfiguration.java similarity index 96% rename from spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/Saml2RelyingPartyRegistrationConfiguration.java rename to spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/Saml2RelyingPartyRegistrationConfiguration.java index b77d5c8ddd..bb7c26332c 100644 --- a/spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/Saml2RelyingPartyRegistrationConfiguration.java +++ b/spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/Saml2RelyingPartyRegistrationConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.security.autoconfigure.saml2; +package org.springframework.boot.security.saml2.autoconfigure; import java.io.InputStream; import java.security.PrivateKey; @@ -27,11 +27,11 @@ import java.util.function.Consumer; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.context.properties.PropertyMapper; -import org.springframework.boot.security.autoconfigure.saml2.Saml2RelyingPartyProperties.AssertingParty; -import org.springframework.boot.security.autoconfigure.saml2.Saml2RelyingPartyProperties.AssertingParty.Verification; -import org.springframework.boot.security.autoconfigure.saml2.Saml2RelyingPartyProperties.Decryption; -import org.springframework.boot.security.autoconfigure.saml2.Saml2RelyingPartyProperties.Registration; -import org.springframework.boot.security.autoconfigure.saml2.Saml2RelyingPartyProperties.Registration.Signing; +import org.springframework.boot.security.saml2.autoconfigure.Saml2RelyingPartyProperties.AssertingParty; +import org.springframework.boot.security.saml2.autoconfigure.Saml2RelyingPartyProperties.AssertingParty.Verification; +import org.springframework.boot.security.saml2.autoconfigure.Saml2RelyingPartyProperties.Decryption; +import org.springframework.boot.security.saml2.autoconfigure.Saml2RelyingPartyProperties.Registration; +import org.springframework.boot.security.saml2.autoconfigure.Saml2RelyingPartyProperties.Registration.Signing; import org.springframework.boot.ssl.pem.PemContent; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Conditional; diff --git a/spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/package-info.java b/spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/package-info.java similarity index 91% rename from spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/package-info.java rename to spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/package-info.java index e1066bd4c3..7a3718e48b 100644 --- a/spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/saml2/package-info.java +++ b/spring-boot-project/spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure/package-info.java @@ -17,4 +17,4 @@ /** * Auto-configuration for Spring Security's SAML 2.0. */ -package org.springframework.boot.security.autoconfigure.saml2; +package org.springframework.boot.security.saml2.autoconfigure; diff --git a/spring-boot-project/spring-boot-security-saml2/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-security-saml2/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000000..671fd2520c --- /dev/null +++ b/spring-boot-project/spring-boot-security-saml2/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,4 @@ +{ + "groups": [], + "properties": [] +} diff --git a/spring-boot-project/spring-boot-security-saml2/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-boot-project/spring-boot-security-saml2/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000..06e8706aa9 --- /dev/null +++ b/spring-boot-project/spring-boot-security-saml2/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.springframework.boot.security.saml2.autoconfigure.Saml2RelyingPartyAutoConfiguration diff --git a/spring-boot-project/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/saml2/Saml2RelyingPartyAutoConfigurationTests.java b/spring-boot-project/spring-boot-security-saml2/src/test/java/org/springframework/boot/security/saml2/autoconfigure/Saml2RelyingPartyAutoConfigurationTests.java similarity index 99% rename from spring-boot-project/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/saml2/Saml2RelyingPartyAutoConfigurationTests.java rename to spring-boot-project/spring-boot-security-saml2/src/test/java/org/springframework/boot/security/saml2/autoconfigure/Saml2RelyingPartyAutoConfigurationTests.java index b49b4579f2..4db74cef79 100644 --- a/spring-boot-project/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/saml2/Saml2RelyingPartyAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-security-saml2/src/test/java/org/springframework/boot/security/saml2/autoconfigure/Saml2RelyingPartyAutoConfigurationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.security.autoconfigure.saml2; +package org.springframework.boot.security.saml2.autoconfigure; import java.io.InputStream; import java.util.List; @@ -280,8 +280,8 @@ class Saml2RelyingPartyAutoConfigurationTests { setupMockResponse(server, new ClassPathResource("idp-metadata")); this.contextRunner.withPropertyValues(PREFIX + ".foo.assertingparty.metadata-uri=" + metadataUrl, PREFIX + ".foo.assertingparty.singlesignon.sign-request=true", - PREFIX + ".foo.signing.credentials[0].private-key-location=classpath:org/springframework/boot/security/autoconfigure/saml2/rsa.key", - PREFIX + ".foo.signing.credentials[0].certificate-location=classpath:org/springframework/boot/security/autoconfigure/saml2/rsa.crt") + PREFIX + ".foo.signing.credentials[0].private-key-location=classpath:org/springframework/boot/security/saml2/autoconfigure/rsa.key", + PREFIX + ".foo.signing.credentials[0].certificate-location=classpath:org/springframework/boot/security/saml2/autoconfigure/rsa.crt") .run((context) -> { RelyingPartyRegistrationRepository repository = context .getBean(RelyingPartyRegistrationRepository.class); diff --git a/spring-boot-project/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/saml2/Saml2RelyingPartyPropertiesTests.java b/spring-boot-project/spring-boot-security-saml2/src/test/java/org/springframework/boot/security/saml2/autoconfigure/Saml2RelyingPartyPropertiesTests.java similarity index 98% rename from spring-boot-project/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/saml2/Saml2RelyingPartyPropertiesTests.java rename to spring-boot-project/spring-boot-security-saml2/src/test/java/org/springframework/boot/security/saml2/autoconfigure/Saml2RelyingPartyPropertiesTests.java index 2941fa2b06..4d5b2861ea 100644 --- a/spring-boot-project/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/saml2/Saml2RelyingPartyPropertiesTests.java +++ b/spring-boot-project/spring-boot-security-saml2/src/test/java/org/springframework/boot/security/saml2/autoconfigure/Saml2RelyingPartyPropertiesTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.security.autoconfigure.saml2; +package org.springframework.boot.security.saml2.autoconfigure; import java.util.Collections; import java.util.Map; diff --git a/spring-boot-project/spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2/certificate-location b/spring-boot-project/spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure/certificate-location similarity index 100% rename from spring-boot-project/spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2/certificate-location rename to spring-boot-project/spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure/certificate-location diff --git a/spring-boot-project/spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2/idp-metadata b/spring-boot-project/spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure/idp-metadata similarity index 100% rename from spring-boot-project/spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2/idp-metadata rename to spring-boot-project/spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure/idp-metadata diff --git a/spring-boot-project/spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2/idp-metadata-with-multiple-providers b/spring-boot-project/spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure/idp-metadata-with-multiple-providers similarity index 100% rename from spring-boot-project/spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2/idp-metadata-with-multiple-providers rename to spring-boot-project/spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure/idp-metadata-with-multiple-providers diff --git a/spring-boot-project/spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2/private-key-location b/spring-boot-project/spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure/private-key-location similarity index 100% rename from spring-boot-project/spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2/private-key-location rename to spring-boot-project/spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure/private-key-location diff --git a/spring-boot-project/spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2/rsa.crt b/spring-boot-project/spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure/rsa.crt similarity index 100% rename from spring-boot-project/spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2/rsa.crt rename to spring-boot-project/spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure/rsa.crt diff --git a/spring-boot-project/spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2/rsa.key b/spring-boot-project/spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure/rsa.key similarity index 100% rename from spring-boot-project/spring-boot-security/src/test/resources/org/springframework/boot/security/autoconfigure/saml2/rsa.key rename to spring-boot-project/spring-boot-security-saml2/src/test/resources/org/springframework/boot/security/saml2/autoconfigure/rsa.key diff --git a/spring-boot-project/spring-boot-security/build.gradle b/spring-boot-project/spring-boot-security/build.gradle index 9ae924c5d9..538e81d6d5 100644 --- a/spring-boot-project/spring-boot-security/build.gradle +++ b/spring-boot-project/spring-boot-security/build.gradle @@ -32,7 +32,6 @@ dependencies { optional("org.springframework.security:spring-security-data") optional("org.springframework.security:spring-security-messaging") optional("org.springframework.security:spring-security-rsocket") - optional("org.springframework.security:spring-security-saml2-service-provider") testImplementation(project(":spring-boot-project:spring-boot-http")) testImplementation(project(":spring-boot-project:spring-boot-jackson")) @@ -46,6 +45,7 @@ dependencies { testImplementation("org.springframework.security:spring-security-oauth2-client") testImplementation("org.springframework.security:spring-security-oauth2-jose") testImplementation("org.springframework.security:spring-security-oauth2-resource-server") + testImplementation("org.springframework.security:spring-security-saml2-service-provider") testRuntimeOnly("ch.qos.logback:logback-classic") testRuntimeOnly("com.zaxxer:HikariCP") diff --git a/spring-boot-project/spring-boot-security/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-boot-project/spring-boot-security/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index a449f66cae..1104acfbd3 100644 --- a/spring-boot-project/spring-boot-security/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/spring-boot-project/spring-boot-security/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1,7 +1,6 @@ org.springframework.boot.security.autoconfigure.reactive.ReactiveSecurityAutoConfiguration org.springframework.boot.security.autoconfigure.reactive.ReactiveUserDetailsServiceAutoConfiguration org.springframework.boot.security.autoconfigure.rsocket.RSocketSecurityAutoConfiguration -org.springframework.boot.security.autoconfigure.saml2.Saml2RelyingPartyAutoConfiguration org.springframework.boot.security.autoconfigure.servlet.SecurityAutoConfiguration org.springframework.boot.security.autoconfigure.servlet.SecurityFilterAutoConfiguration org.springframework.boot.security.autoconfigure.servlet.UserDetailsServiceAutoConfiguration diff --git a/spring-boot-project/spring-boot-test-autoconfigure/build.gradle b/spring-boot-project/spring-boot-test-autoconfigure/build.gradle index c71a595676..2dc02ea7ad 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/build.gradle +++ b/spring-boot-project/spring-boot-test-autoconfigure/build.gradle @@ -7,6 +7,14 @@ plugins { description = "Spring Boot Test AutoConfigure" +configurations.all { + resolutionStrategy.eachDependency { + if (it.requested.group == 'org.opensaml') { + it.useVersion '4.0.1' + } + } +} + dependencies { api(project(":spring-boot-project:spring-boot-all")) api(project(":spring-boot-project:spring-boot-test")) @@ -65,6 +73,7 @@ dependencies { 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-security-saml2")) optional(project(":spring-boot-project:spring-boot-tx")) optional(project(":spring-boot-project:spring-boot-validation")) optional(project(":spring-boot-project:spring-boot-webmvc")) @@ -137,17 +146,9 @@ dependencies { testImplementation("org.jooq:jooq") testImplementation("org.junit.platform:junit-platform-engine") testImplementation("org.junit.platform:junit-platform-launcher") - testImplementation("org.opensaml:opensaml-core:4.0.1") - testImplementation("org.opensaml:opensaml-saml-api:4.0.1") - testImplementation("org.opensaml:opensaml-saml-impl:4.0.1") testImplementation("org.springframework.hateoas:spring-hateoas") testImplementation("org.springframework.plugin:spring-plugin-core") testImplementation("org.springframework.security:spring-security-oauth2-client") - testImplementation("org.springframework.security:spring-security-saml2-service-provider") { - exclude group: "org.opensaml", module: "opensaml-core" - exclude group: "org.opensaml", module: "opensaml-saml-api" - exclude group: "org.opensaml", module: "opensaml-saml-impl" - } testImplementation("org.thymeleaf:thymeleaf") testRuntimeOnly(project(":spring-boot-project:spring-boot-tomcat")) 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 37ef6688a2..524269ef0a 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 @@ -5,9 +5,9 @@ optional:org.springframework.boot.security.autoconfigure.servlet.UserDetailsServ 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 +optional:org.springframework.boot.security.saml2.autoconfigure.Saml2RelyingPartyAutoConfiguration 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.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-tests/spring-boot-smoke-tests/spring-boot-smoke-test-saml2-service-provider/build.gradle b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-saml2-service-provider/build.gradle index b3b8560e86..cfd994d04e 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-saml2-service-provider/build.gradle +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-saml2-service-provider/build.gradle @@ -15,7 +15,7 @@ configurations.all { dependencies { implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-security")) implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-web")) - implementation("org.springframework.security:spring-security-saml2-service-provider") + implementation(project(":spring-boot-project:spring-boot-security-saml2")) testImplementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-test")) testImplementation("org.apache.httpcomponents.client5:httpclient5")