【发布时间】:2017-11-08 07:14:01
【问题描述】:
这是我的配置代码sn-p
@Override
public void configure(HttpSecurity http) throws Exception {
http.
authorizeRequests()
.antMatchers("/").permitAll()
.antMatchers("/api/user/**").hasAnyAuthority("ROLE_ADMIN")
.antMatchers("/api/status/**").hasAuthority("ROLE_ADMIN").anyRequest()
.authenticated()
.and()
.exceptionHandling()
.accessDeniedHandler(new OAuth2AccessDeniedHandler());
}
在此我需要使ROLE_ADMIN 仅访问POST 和PUT httpmethods。他应该无法访问GET 或DELETE httpmethod。我需要在单个 .antMatchers() 方法中完成此操作。
我该怎么做?
【问题讨论】:
标签: spring-mvc spring-boot spring-security spring-security-oauth2