系统参数过滤器
系统参数过滤器
主要处理系统参数的传播,例如:用户登录后的信息
默认传输参数
- 登录后用户id
- requestId,请求唯一标识
- 数据权限字符串
自定义参数
网管实现自定义参数后,可以通过自定义参数传送给后面的微服务。
需要继承com.wueasy.cloud.gateway.service.CustomParameterService
接口
通过map定义定义需要传输的参数,key
为header名称,value
为header值
@Service
public class CustomParameterServiceImpl implements CustomParameterService {
@Override
public Map<String, String> getCustomParameterMap(ServerWebExchange exchange) {
Map<String, String> map = new HashMap<>();
map.put("usercode", "123456");
return map;
}
}