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 5151import org .springframework .security .oauth2 .core .user .OAuth2User ;
5252import org .springframework .security .web .SecurityFilterChain ;
5353import org .springframework .security .web .authentication .UsernamePasswordAuthenticationFilter ;
54+ import org .springframework .security .web .csrf .CookieCsrfTokenRepository ;
55+ import org .springframework .security .web .csrf .XorCsrfTokenRequestAttributeHandler ;
5456import org .springframework .security .web .savedrequest .HttpSessionRequestCache ;
5557
5658@ Configuration
@@ -72,7 +74,21 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
7274 http .addFilterBefore (tokenAuthenticationFilter (), UsernamePasswordAuthenticationFilter .class )
7375 .requestCache (Customizer .withDefaults ())
7476 .requestCache (cache -> cache .requestCache (new HttpSessionRequestCache ()))
75- .csrf (AbstractHttpConfigurer ::disable )
77+ .csrf (
78+ csrf ->
79+ csrf .csrfTokenRepository (CookieCsrfTokenRepository .withHttpOnlyFalse ())
80+ .csrfTokenRequestHandler (new XorCsrfTokenRequestAttributeHandler ())
81+ .ignoringRequestMatchers (
82+ "/api/health" ,
83+ "/api/comcheck/**" ,
84+ "/api/player/**" ,
85+ "/api/settings" ,
86+ "/api/agent/**" ,
87+ "/api/implant/**" ,
88+ "/api/login" ,
89+ "/api/reset/**" ,
90+ "/api/**" ,
91+ "/actuator/**" ))
7692 .formLogin (AbstractHttpConfigurer ::disable )
7793 .securityContext (securityContext -> securityContext .requireExplicitSave (false ))
7894 .authorizeHttpRequests (
You can’t perform that action at this time.
0 commit comments