0
respostas

You don't have authorization to view this page. HTTP ERROR 403

http://localhost:8080/swagger-ui/index.html funciona certinho, mas o http://localhost:8080/v3/api-docs não.

      @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("/v3/api-docs/**", "/swagger-ui/index.html/", "/swagger-ui/**").permitAll();
                req.anyRequest().authenticated()
                ;
            })
            .addFilterBefore(securityFilter, UsernamePasswordAuthenticationFilter.class)
            .build();
}


<dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
        <version>2.0.2</version>
    </dependency>
    
    já mudei para todas as versões compatíveis.