【发布时间】:2017-05-01 23:23:25
【问题描述】:
我将在我的 Spring Boot (1.4.2v) 中使用带有 swagger-ui 的 springfox (2.6.1v)。
它的配置看起来:
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
.genericModelSubstitutes(ResponseEntity.class);
}
}
问题是我的招摇落后于 Spring Security,我只需要允许管理员访问那里。
问题是允许 swagger-ui 在我的应用程序中工作的匹配器集应该是什么?
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("??? <<<what_should_be_here>>> ???") // what should be here?
.hasRole("TENANT_ADMIN");
}
}
【问题讨论】:
标签: spring-security swagger-ui springfox