diff --git a/start-site/src/main/java/io/spring/start/site/extension/dependency/DependencyProjectGenerationConfiguration.java b/start-site/src/main/java/io/spring/start/site/extension/dependency/DependencyProjectGenerationConfiguration.java index a5240dc1ad6..62a456c9e29 100644 --- a/start-site/src/main/java/io/spring/start/site/extension/dependency/DependencyProjectGenerationConfiguration.java +++ b/start-site/src/main/java/io/spring/start/site/extension/dependency/DependencyProjectGenerationConfiguration.java @@ -46,6 +46,7 @@ * @author Stephane Nicoll * @author EddĂș MelĂ©ndez * @author Kazuki Shimizu + * @author Moritz Halbritter */ @ProjectGenerationConfiguration public class DependencyProjectGenerationConfiguration { @@ -67,6 +68,12 @@ public SpringSecurityTestBuildCustomizer securityTestBuildCustomizer() { return new SpringSecurityTestBuildCustomizer(); } + @Bean + @ConditionalOnRequestedDependency("oauth2-client") + SpringSecurityTestBuildCustomizer oauth2ClientTestBuildCustomizer() { + return new SpringSecurityTestBuildCustomizer(); + } + @Bean @ConditionalOnRequestedDependency("security") public SpringSecurityRSocketBuildCustomizer securityRSocketBuildCustomizer() { diff --git a/start-site/src/main/java/io/spring/start/site/extension/dependency/thymeleaf/ThymeleafBuildCustomizer.java b/start-site/src/main/java/io/spring/start/site/extension/dependency/thymeleaf/ThymeleafBuildCustomizer.java index 47d17d7606a..236bdfd0ea0 100644 --- a/start-site/src/main/java/io/spring/start/site/extension/dependency/thymeleaf/ThymeleafBuildCustomizer.java +++ b/start-site/src/main/java/io/spring/start/site/extension/dependency/thymeleaf/ThymeleafBuildCustomizer.java @@ -24,12 +24,13 @@ * A {@link BuildCustomizer} for Thymeleaf. * * @author Stephane Nicoll + * @author Moritz Halbritter */ public class ThymeleafBuildCustomizer implements BuildCustomizer { @Override public void customize(Build build) { - if (build.dependencies().has("security")) { + if (build.dependencies().has("security") || build.dependencies().has("oauth2-client")) { build.dependencies() .add("thymeleaf-extras-spring-security", Dependency.withCoordinates("org.thymeleaf.extras", "thymeleaf-extras-springsecurity6")); diff --git a/start-site/src/test/java/io/spring/start/site/extension/dependency/springsecurity/SpringSecurityTestBuildCustomizerTests.java b/start-site/src/test/java/io/spring/start/site/extension/dependency/springsecurity/SpringSecurityTestBuildCustomizerTests.java index 4f705726525..1f9f392ff1f 100755 --- a/start-site/src/test/java/io/spring/start/site/extension/dependency/springsecurity/SpringSecurityTestBuildCustomizerTests.java +++ b/start-site/src/test/java/io/spring/start/site/extension/dependency/springsecurity/SpringSecurityTestBuildCustomizerTests.java @@ -27,6 +27,7 @@ * Tests for {@link SpringSecurityTestBuildCustomizer}. * * @author Stephane Nicoll + * @author Moritz Halbritter */ class SpringSecurityTestBuildCustomizerTests extends AbstractExtensionTests { @@ -39,6 +40,15 @@ void securityTestIsAddedWithSecurity() { .hasDependenciesSize(3); } + @Test + void securityTestIsAddedWithOAuth2Client() { + ProjectRequest request = createProjectRequest("oauth2-client"); + assertThat(mavenPom(request)).hasDependency(Dependency.createSpringBootStarter("oauth2-client")) + .hasDependency(Dependency.createSpringBootStarter("test", Dependency.SCOPE_TEST)) + .hasDependency(springSecurityTest()) + .hasDependenciesSize(3); + } + @Test void securityTestIsNotAddedWithoutSpringSecurity() { ProjectRequest request = createProjectRequest("web"); diff --git a/start-site/src/test/java/io/spring/start/site/extension/dependency/thymeleaf/ThymeleafBuildCustomizerTests.java b/start-site/src/test/java/io/spring/start/site/extension/dependency/thymeleaf/ThymeleafBuildCustomizerTests.java index 97482ed6c07..9a4eda8b6c0 100644 --- a/start-site/src/test/java/io/spring/start/site/extension/dependency/thymeleaf/ThymeleafBuildCustomizerTests.java +++ b/start-site/src/test/java/io/spring/start/site/extension/dependency/thymeleaf/ThymeleafBuildCustomizerTests.java @@ -27,6 +27,7 @@ * Tests for {@link ThymeleafBuildCustomizer}. * * @author Stephane Nicoll + * @author Moritz Halbritter */ class ThymeleafBuildCustomizerTests extends AbstractExtensionTests { @@ -39,6 +40,15 @@ void thymeleafWithSpringSecurityAndSpringBootAddsExtrasDependency() { "thymeleaf-extras-springsecurity6")); } + @Test + void thymeleafWithOAuth2ClientAndSpringBootAddsExtrasDependency() { + ProjectRequest projectRequest = createProjectRequest("thymeleaf", "oauth2-client"); + assertThat(mavenPom(projectRequest)).hasDependency(Dependency.createSpringBootStarter("thymeleaf")) + .hasDependency(Dependency.createSpringBootStarter("oauth2-client")) + .hasDependency(Dependency.withId("thymeleaf-extras-spring-security", "org.thymeleaf.extras", + "thymeleaf-extras-springsecurity6")); + } + @Test void thymeleafWithoutSpringSecurityDoesNotAddExtrasDependency() { assertThat(mavenPom(createProjectRequest("thymeleaf", "web")))