【发布时间】:2018-01-03 10:09:44
【问题描述】:
我正在尝试将 Spring 安全配置为仅阻止对 swagger 的请求,但它会阻止所有 url。 有谁知道如何只锁定 swagger 的 url 而其余的都不安全?
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.authorizeRequests().anyRequest().permitAll()
.and()
.authorizeRequests()
.antMatchers("/swagger*/**").authenticated();
http.httpBasic();
}
【问题讨论】:
-
除了招摇,那不是挡住了一切吗?
-
这阻碍了我的帖子 localhost:8012/bus/refresh
标签: java spring-security springfox