NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
# 添加FeignClient访问其他微服务权限 > 其他步骤参考【为提供者添加资源防护】 ```java package com.gosuncn.config; @Configuration public class FeignClientOAuth2RelayConfig { @Bean public FeignClientOAuth2RelayRequestInterceptor feignClientOAuth2RelayRequestInterceptor() { return new FeignClientOAuth2RelayRequestInterceptor(); } public static class FeignClientOAuth2RelayRequestInterceptor implements RequestInterceptor { @Override public void apply(RequestTemplate template) { RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); if (requestAttributes != null) { String token = ((ServletRequestAttributes) requestAttributes).getRequest().getHeader("Authorization"); if (token != null && !"".equals(token.trim())) { template.header("Authorization", token); } } } } } ```