首页>代码>基于Spring Boot、Spring Cloud、Spring Oauth2 和 Spring Cloud Netflix 等框架构建的微服务项目>/spring-boot-cloud/auth-service/src/main/java/cn/zhangxd/auth/config/ResourceServerConfiguration.java
package cn.zhangxd.auth.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;

@Configuration
@EnableResourceServer
public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter {

    @Override
    public void configure(HttpSecurity http) throws Exception {
        http
                .requestMatchers().antMatchers("/current")
                .and()
                .authorizeRequests()
                .antMatchers("/current").access("#oauth2.hasScope('read')");
    }
}
最近下载更多
徐万强  LV9 2023年12月12日
iceboard  LV2 2023年2月26日
  LV6 2022年12月6日
2317696509  LV6 2022年9月2日
樊樊樊樊樊樊阵雨  LV18 2022年8月17日
qianyunjie  LV8 2022年5月30日
x646936674  LV10 2022年3月5日
夕阳2266  LV10 2021年11月25日
27866849  LV4 2021年11月10日
十里画纱  LV5 2021年9月15日
最近浏览更多
徐万强  LV9 2023年12月12日
流连瓦盖法  LV7 2023年11月29日
XNDIC522 2023年11月6日
暂无贡献等级
Rd_s20192753 2023年7月31日
暂无贡献等级
lichengai  LV7 2023年7月4日
随便取个名字_哈哈  LV27 2023年5月18日
lipiao161  LV15 2023年4月27日
chufashiwo  LV1 2023年4月17日
最代码安逸  LV15 2023年3月1日
iceboard  LV2 2023年2月26日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友