美文网首页spring-cloud
oauth2如何限定只能访问授权过的资源?scope

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

作者: 复苏森林 | 来源:发表于2016-02-29 19:02 被阅读3133次

    在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')");
    }
    
    

    相关文章

      网友评论

        本文标题:oauth2如何限定只能访问授权过的资源?scope

        本文链接:https://www.haomeiwen.com/subject/nvpgkttx.html