搜索
您的当前位置:首页正文

oauth2如何限定只能访问授权过的资源?scope

来源:二三娱乐

在ResourceServerConfigurerAdapter 里定义

@Override
public void configure(HttpSecurity http) throws Exception { 
       http.authorizeRequests().antMatchers("/setting/**").access("#oauth2.hasScope('setting')");   
       http.authorizeRequests().antMatchers("/analysis/**").access("#oauth2.hasScope('read')");
}

Top