Merge pull request #4859 from amit2103/BAEL-7608-1

[BAEL-7608] - Fixed SecurityIntegrationTest with redirecting to login
This commit is contained in:
Loredana Crusoveanu 2018-07-30 22:46:55 +03:00 committed by GitHub
commit aabbd93fcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -11,7 +11,7 @@ import org.springframework.web.server.adapter.WebHttpHandlerBuilder;
import reactor.ipc.netty.NettyContext;
import reactor.ipc.netty.http.server.HttpServer;
@ComponentScan(basePackages = {"com.baeldung.security"})
@ComponentScan(basePackages = {"com.baeldung.reactive.security"})
@EnableWebFlux
public class SpringSecurity5Application {

View File

@ -19,7 +19,7 @@ public class SecurityConfig {
@Bean
public SecurityWebFilterChain securitygWebFilterChain(ServerHttpSecurity http) {
return http.authorizeExchange()
.pathMatchers("/admin")
.pathMatchers("/", "/admin")
.hasAuthority("ROLE_ADMIN")
.matchers(EndpointRequest.to(FeaturesEndpoint.class))
.permitAll()

View File

@ -28,7 +28,7 @@ public class SecurityIntegrationTest {
@Test
public void whenNoCredentials_thenRedirectToLogin() {
this.rest.get().uri("/").exchange().expectStatus().is4xxClientError();
this.rest.get().uri("/").exchange().expectStatus().is3xxRedirection();
}
@Test