Add support for Reactive security

Closes gh-460
This commit is contained in:
Stephane Nicoll 2017-10-01 17:14:34 +02:00
parent c2a8b29efd
commit bf2a9911e9
3 changed files with 28 additions and 6 deletions

View File

@ -53,7 +53,8 @@ class SpringSecurityTestRequestPostProcessor implements ProjectRequestPostProces
private boolean hasSpringSecurity(ProjectRequest request) {
return request.getResolvedDependencies().stream()
.anyMatch(d -> "security".equals(d.getId()));
.anyMatch(d -> "security".equals(d.getId())
|| "security-reactive".equals(d.getId()));
}
private boolean isAtLeastAfter(ProjectRequest request, Version version) {

View File

@ -113,6 +113,11 @@ initializr:
description: Authenticating a User with LDAP
- rel: reference
href: http://docs.spring.io/spring-boot/docs/{bootVersion}/reference/htmlsingle/#boot-features-security
- name: Reactive Security
id: security-reactive
description: Secure your reactive application via spring-security-webflux
versionRange: 2.0.0.M5
weight: 90
- name: Aspects
id: aop
description: Create your own Aspects using Spring AOP and AspectJ

View File

@ -29,15 +29,23 @@ public class SpringSecurityTestRequestPostProcessorTests
extends AbstractRequestPostProcessorTests {
@Test
public void securityTestIsAdded() {
public void securityTestIsAddedWithSecurity() {
ProjectRequest request = createProjectRequest("security");
Dependency springSecurityTest = Dependency.withId(
"spring-security-test", "org.springframework.security", "spring-security-test");
springSecurityTest.setScope(Dependency.SCOPE_TEST);
generateMavenPom(request)
.hasSpringBootStarterDependency("security")
.hasSpringBootStarterTest()
.hasDependency(springSecurityTest)
.hasDependency(springSecurityTest())
.hasDependenciesCount(3);
}
@Test
public void securityTestIsAddedWithSecurityReactive() {
ProjectRequest request = createProjectRequest("security-reactive");
request.setBootVersion("2.0.0.BUILD-SNAPSHOT");
generateMavenPom(request)
.hasSpringBootStarterDependency("security-reactive")
.hasSpringBootStarterTest()
.hasDependency(springSecurityTest())
.hasDependenciesCount(3);
}
@ -60,4 +68,12 @@ public class SpringSecurityTestRequestPostProcessorTests
.hasDependenciesCount(2);
}
private static Dependency springSecurityTest() {
Dependency dependency = Dependency.withId("spring-security-test",
"org.springframework.security", "spring-security-test");
dependency.setScope(Dependency.SCOPE_TEST);
return dependency;
}
}