O swagger não funciona mas a api-docs sim
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception{
//cross-site request forgery
System.out.println("FilterChain Chamado com sucesso");
return http.
csrf(csrf -> csrf.disable()).
sessionManagement(sm -> sm
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)).authorizeHttpRequests
(req -> {req.requestMatchers("/login").permitAll()
.requestMatchers("/v3/api-docs","/swagger-ui/**","/swagger-ui.html").permitAll();
req.anyRequest().authenticated();})
.addFilterBefore(securityFilter, UsernamePasswordAuthenticationFilter.class)
.build();
}
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.8.5</version>
</dependency>