-
Notifications
You must be signed in to change notification settings - Fork 0
Admin Dashbaord UI and CSRF
Paul Sterl edited this page Jul 6, 2025
·
2 revisions
Axios should work with the following spring config out of the box with csrf:
<dependency>
<groupId>org.sterl.spring</groupId>
<artifactId>spring-persistent-tasks-ui</artifactId>
<version>${spt.version}</version>
</dependency>
@SpringBootApplication
@EnableSpringPersistentTasks
@EnableSpringPersistentTasksUI
public class XYApplication
@Bean
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.httpBasic(org.springframework.security.config.Customizer.withDefaults())
.csrf(c ->
c.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.csrfTokenRequestHandler(new CsrfTokenRequestAttributeHandler())
);
return http.build();
}
more informations: https://docs.spring.io/spring-security/reference/servlet/exploits/csrf.html