【发布时间】:2020-07-14 06:05:01
【问题描述】:
Rest 端点受OAuth 保护,但出于某种原因,我可以在没有令牌的情况下点击/users/user。请让我知道缺少什么。
在我的资源类中,我提到了以下配置来保护端点。
@Override
public void configure(HttpSecurity http) throws Exception {
http.
anonymous().disable()
.authorizeRequests()
.antMatchers("/users/**")
.access("hasRole('ADMIN')")
.and()
.exceptionHandling()
.accessDeniedHandler(new OAuth2AccessDeniedHandler());
}
【问题讨论】:
标签: java spring-boot rest oauth