【发布时间】:2017-02-16 14:55:36
【问题描述】:
我正在尝试弄清楚如何使用 Spring Security OAuth2 的 @EnableResourceServer,同时保持默认 Spring Boot 的执行器安全性不变。我使用 Spring Boot 1.5.1 和默认版本的依赖项。我有以下配置
@Configuration
@EnableResourceServer
@EnableWebSecurity(debug=true)
@EnableGlobalMethodSecurity
public class OAuthConfig extends ResourceServerConfigurerAdapter {
@Override
public void configure(final HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
.mvcMatchers("/resource/{type}").permitAll()
.antMatchers("/resource/data/**").authenticated();
}
}
我没有明确配置任何其他安全设置。我认为执行器端点将继续得到适当的保护,但我得到 401,并且在检查安全调试日志时,它没有显示任何有关 HTTP Basic 的信息。我做错了什么吗?我还需要一些其他配置吗?
【问题讨论】:
-
你要什么网址?我希望 .antMatchers("/
/**").permitAll()
标签: spring-boot spring-security-oauth2 spring-boot-actuator