[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.http.server.HttpServer;
|
||||
|
||||
@ComponentScan(basePackages = {"com.baeldung.security"})
|
||||
@ComponentScan(basePackages = {"com.baeldung.reactive.security"})
|
||||
@EnableWebFlux
|
||||
public class SpringSecurity5Application {
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue