Pra quem quiser utilizar a versão 6.2 o código que funcionou para mim no SecurityConfiguration
@Configuration
@EnableWebSecurity
public class SecurityConfiguration {
@Autowired
private SecurityFilter securityFilter;
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
return http.csrf(AbstractHttpConfigurer::disable).
sessionManagement((session) -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)).
authorizeHttpRequests((auth) -> auth.requestMatchers(AUTH_PATH).permitAll().anyRequest().authenticated()).addFilterBefore(securityFilter, UsernamePasswordAuthenticationFilter.class).
build();
}
@Bean
public AuthenticationManager authenticationManager(AuthenticationConfiguration configuration) throws Exception {
return configuration.getAuthenticationManager();
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
}