Skip to content

Commit aabbd93

Browse files
authored
Merge pull request eugenp#4859 from amit2103/BAEL-7608-1
[BAEL-7608] - Fixed SecurityIntegrationTest with redirecting to login
2 parents 7c83e6d + 680e0c2 commit aabbd93

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎spring-5-reactive/src/main/java/com/baeldung/reactive/SpringSecurity5Application.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import reactor.ipc.netty.NettyContext;
1212
import reactor.ipc.netty.http.server.HttpServer;
1313

14-
@ComponentScan(basePackages = {"com.baeldung.security"})
14+
@ComponentScan(basePackages = {"com.baeldung.reactive.security"})
1515
@EnableWebFlux
1616
public class SpringSecurity5Application {
1717

‎spring-5-reactive/src/main/java/com/baeldung/reactive/security/SecurityConfig.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class SecurityConfig {
1919
@Bean
2020
public SecurityWebFilterChain securitygWebFilterChain(ServerHttpSecurity http) {
2121
return http.authorizeExchange()
22-
.pathMatchers("/admin")
22+
.pathMatchers("/", "/admin")
2323
.hasAuthority("ROLE_ADMIN")
2424
.matchers(EndpointRequest.to(FeaturesEndpoint.class))
2525
.permitAll()

‎spring-5-reactive/src/test/java/com/baeldung/security/SecurityIntegrationTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void setup() {
2828

2929
@Test
3030
public void whenNoCredentials_thenRedirectToLogin() {
31-
this.rest.get().uri("/").exchange().expectStatus().is4xxClientError();
31+
this.rest.get().uri("/").exchange().expectStatus().is3xxRedirection();
3232
}
3333

3434
@Test

0 commit comments

Comments
 (0)