@Bean public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { return http.csrf(csrf -> csrf.disable()) .sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) .authorizeHttpRequests(req -> { req.requestMatchers(HttpMethod.POST,"/login").permitAll(); req.requestMatchers(HttpMethod.DELETE, "/medicos").hasRole("ADMIN") .requestMatchers(HttpMethod.DELETE, "/pacientes").hasRole("ADMIN"); req.anyRequest().authenticated(), and().addFilterBefore(securityFilter, UsernamePasswordAuthenticationFilter.class); }) .build(); } ))
print da tela do intelij
nessa imagem você consegue ver o erro !
o erro esta na linha 38