[BAEL-7608] - Fixed SecurityIntegrationTest with redirecting to login
This commit is contained in:
parent
7c83e6d22e
commit
680e0c24a7
|
@ -11,7 +11,7 @@ import org.springframework.web.server.adapter.WebHttpHandlerBuilder;
|
||||||
import reactor.ipc.netty.NettyContext;
|
import reactor.ipc.netty.NettyContext;
|
||||||
import reactor.ipc.netty.http.server.HttpServer;
|
import reactor.ipc.netty.http.server.HttpServer;
|
||||||
|
|
||||||
@ComponentScan(basePackages = {"com.baeldung.security"})
|
@ComponentScan(basePackages = {"com.baeldung.reactive.security"})
|
||||||
@EnableWebFlux
|
@EnableWebFlux
|
||||||
public class SpringSecurity5Application {
|
public class SpringSecurity5Application {
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class SecurityConfig {
|
||||||
@Bean
|
@Bean
|
||||||
public SecurityWebFilterChain securitygWebFilterChain(ServerHttpSecurity http) {
|
public SecurityWebFilterChain securitygWebFilterChain(ServerHttpSecurity http) {
|
||||||
return http.authorizeExchange()
|
return http.authorizeExchange()
|
||||||
.pathMatchers("/admin")
|
.pathMatchers("/", "/admin")
|
||||||
.hasAuthority("ROLE_ADMIN")
|
.hasAuthority("ROLE_ADMIN")
|
||||||
.matchers(EndpointRequest.to(FeaturesEndpoint.class))
|
.matchers(EndpointRequest.to(FeaturesEndpoint.class))
|
||||||
.permitAll()
|
.permitAll()
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class SecurityIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenNoCredentials_thenRedirectToLogin() {
|
public void whenNoCredentials_thenRedirectToLogin() {
|
||||||
this.rest.get().uri("/").exchange().expectStatus().is4xxClientError();
|
this.rest.get().uri("/").exchange().expectStatus().is3xxRedirection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue