Skip to content

Commit 3b70df6

Browse files
committed
do not authorize requests that get dispatched async
With spring-projects/spring-security#11107 the default to filter all dispatcher types was changed to true.
1 parent 82283ec commit 3b70df6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

spring-boot-admin-samples/spring-boot-admin-sample-servlet/src/main/java/de/codecentric/boot/admin/SecuritySecureConfig.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import java.util.UUID;
2020

21+
import jakarta.servlet.DispatcherType;
22+
2123
import org.springframework.boot.autoconfigure.security.SecurityProperties;
2224
import org.springframework.context.annotation.Bean;
2325
import org.springframework.context.annotation.Configuration;
@@ -60,8 +62,9 @@ protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
6062
.requestMatchers(new AntPathRequestMatcher(this.adminServer.path("/variables.css"))).permitAll()
6163
.requestMatchers(new AntPathRequestMatcher(this.adminServer.path("/actuator/info"))).permitAll()
6264
.requestMatchers(new AntPathRequestMatcher(this.adminServer.path("/actuator/health"))).permitAll()
63-
.requestMatchers(new AntPathRequestMatcher(this.adminServer.path("/login"))).permitAll().anyRequest()
64-
.authenticated() // <2>
65+
.requestMatchers(new AntPathRequestMatcher(this.adminServer.path("/login"))).permitAll()
66+
.dispatcherTypeMatchers(DispatcherType.ASYNC).permitAll()
67+
.anyRequest().authenticated() // <2>
6568
).formLogin(
6669
(formLogin) -> formLogin.loginPage(this.adminServer.path("/login")).successHandler(successHandler).and() // <3>
6770
).logout((logout) -> logout.logoutUrl(this.adminServer.path("/logout"))).httpBasic(Customizer.withDefaults()) // <4>

0 commit comments

Comments
 (0)