File tree Expand file tree Collapse file tree
openaev-api/src/main/java/io/openaev/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343import org .springframework .security .oauth2 .core .user .OAuth2User ;
4444import org .springframework .security .web .SecurityFilterChain ;
4545import org .springframework .security .web .authentication .UsernamePasswordAuthenticationFilter ;
46+ import org .springframework .security .web .csrf .CookieCsrfTokenRepository ;
47+ import org .springframework .security .web .csrf .XorCsrfTokenRequestAttributeHandler ;
4648import org .springframework .security .web .savedrequest .HttpSessionRequestCache ;
4749
4850@ Configuration
@@ -64,7 +66,21 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
6466 http .addFilterBefore (tokenAuthenticationFilter (), UsernamePasswordAuthenticationFilter .class )
6567 .requestCache (Customizer .withDefaults ())
6668 .requestCache (cache -> cache .requestCache (new HttpSessionRequestCache ()))
67- .csrf (AbstractHttpConfigurer ::disable )
69+ .csrf (
70+ csrf ->
71+ csrf .csrfTokenRepository (CookieCsrfTokenRepository .withHttpOnlyFalse ())
72+ .csrfTokenRequestHandler (new XorCsrfTokenRequestAttributeHandler ())
73+ .ignoringRequestMatchers (
74+ "/api/health" ,
75+ "/api/comcheck/**" ,
76+ "/api/player/**" ,
77+ "/api/settings" ,
78+ "/api/agent/**" ,
79+ "/api/implant/**" ,
80+ "/api/login" ,
81+ "/api/reset/**" ,
82+ "/api/**" ,
83+ "/actuator/**" ))
6884 .formLogin (AbstractHttpConfigurer ::disable )
6985 .securityContext (securityContext -> securityContext .requireExplicitSave (false ))
7086 .authorizeHttpRequests (
You can’t perform that action at this time.
0 commit comments