📜  spring boot swagger ui 401 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:15.343000             🧑  作者: Mango

代码示例1
// Fixed by lowering the swagger version to 2.7.0

@EnableWebSecurity
@Configuration
public class ResourceServerConfig extends WebSecurityConfigurerAdapter {
//...//
    public static final String[] AUTH_WHITELIST = {
        "/swagger-ui.html/**", "/configuration/**", "/swagger-resources/**", "/v2/api-docs", "/webjars/**"
    };
//...//

    @Override
    public void configure(WebSecurity web) throws Exception {
        web.ignoring().mvcMatchers(HttpMethod.OPTIONS, "/**");
        web.ignoring().antMatchers(AUTH_WHITELIST);
    }
  
}