Dies ist meine Sicherheitsfilterkette: < /p>
Code: Select all
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.csrf().disable()
.authorizeRequests()
.requestMatchers("/api/v1/auth/**").permitAll()
.requestMatchers(HttpMethod.GET, "/api/v1/products/**").permitAll()
.requestMatchers("/api/v1/user/**").permitAll() //i think the problem is either here
.anyRequest().authenticated()
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authenticationProvider(authenticationProvider)
.addFilterBefore(jwtAuthFilter, UsernamePasswordAuthenticationFilter.class);
/*http.formLogin();
http.httpBasic();*/
return http.build();
}
Code: Select all
.requestMatchers(HttpMethod.POST, "/api/v1/user/**")
< /code>
oder < /p>
.requestMatchers(HttpMethod.POST, "/api/v1/user/self-registration")
< /code>
oder < /p>
.requestMatchers("/api/v1/user/self-registration")
< /code>
Aber nichts hat sich geändert..requestMatchers(HttpMethod.GET , "/api/v1/products/**").permitAll()
Frühlingssicherheit Neueste < /li>
< /ul>
---- Update --- < /pl.
Code: Select all
2023-04-21T16:42:12.328+02:00 DEBUG 13148 --- [nio-8082-exec-1] o.s.security.web.FilterChainProxy : Securing POST /api/v1/user/self-registration
2023-04-21T16:42:12.337+02:00 DEBUG 13148 --- [nio-8082-exec-1] o.s.s.w.a.AnonymousAuthenticationFilter : Set SecurityContextHolder to anonymous SecurityContext
2023-04-21T16:42:12.353+02:00 DEBUG 13148 --- [nio-8082-exec-1] o.s.s.w.a.i.FilterSecurityInterceptor : Authorized filter invocation [POST /api/v1/user/self-registration] with attributes [permitAll]
2023-04-21T16:42:12.353+02:00 DEBUG 13148 --- [nio-8082-exec-1] o.s.security.web.FilterChainProxy : Secured POST /api/v1/user/self-registration
2023-04-21T16:42:12.373+02:00 DEBUG 13148 --- [nio-8082-exec-1] o.s.security.web.FilterChainProxy : Securing POST /error
2023-04-21T16:42:12.376+02:00 DEBUG 13148 --- [nio-8082-exec-1] o.s.s.w.a.AnonymousAuthenticationFilter : Set SecurityContextHolder to anonymous SecurityContext
2023-04-21T16:42:12.376+02:00 DEBUG 13148 --- [nio-8082-exec-1] o.s.s.w.a.i.FilterSecurityInterceptor : Failed to authorize filter invocation [POST /error] with attributes [authenticated]
2023-04-21T16:42:12.376+02:00 DEBUG 13148 --- [nio-8082-exec-1] o.s.s.w.a.Http403ForbiddenEntryPoint : Pre-authenticated entry point called. Rejecting access
< /code>
Dies sind die Anforderungsheader. Es war nicht das Problem. Zeichenfolgen der gleichen .RequestMatchers ()
Für den Moment, in dem der Filter Chan diese Anforderung enthält, entspricht dies
Code: Select all
.requestMatchers("/api/v1/auth/**","/api/v1/user/selfregistration")
.permitAll()
ty