【发布时间】:2016-10-02 01:13:17
【问题描述】:
在我的 Spring Boot 应用程序中,我配置了以下 OAuth2 ResourceServer:
@Override
public void configure(HttpSecurity http) throws Exception {
// @formatter:off
http
.antMatcher("/api/**").authorizeRequests()
.antMatchers("/api/v1.0/users").permitAll()
.anyRequest().authenticated()
.and()
.csrf().disable()
.sessionManagement().sessionCreationPolicy(STATELESS);
// @formatter:on
}
在我的 REST API UserController 中,我有两种不同的请求处理程序方法 - 用于 POST 和 GET http 方法。目前上述配置中的两者都是公开的。
我想保护 POST 方法并将 GET 公开,即使对于匿名用户也是如此
如何更改上述配置以支持此功能?
【问题讨论】:
标签: java spring spring-security spring-security-oauth2