master
冯凯 2023-11-22 14:45:47 +08:00
parent f5d0f4e473
commit 40cca10e8b
1 changed files with 11 additions and 7 deletions

View File

@ -30,15 +30,19 @@ public class CacheRequestGatewayFilter implements GatewayFilter {
String userId = exchange.getRequest().getHeaders().getFirst(SecurityConstants.DETAILS_USER_ID);
log.info("经过公司过滤器,{}", userId);
log.info("请求的uri是:{}",exchange.getRequest().getPath().toString());
// GET DELETE 不过滤
RedisService redisService = SpringUtils.getBean(RedisService.class);
FirmInfoCache firmInfoCache = redisService.getCacheObject("company:" + userId);
log.info("企业对象是{}:", JSONObject.toJSONString(firmInfoCache));
if ("/firm/firm/by/userId".equals(exchange.getRequest().getPath().toString())){
// GET DELETE 不过滤
RedisService redisService = SpringUtils.getBean(RedisService.class);
FirmInfoCache firmInfoCache = redisService.getCacheObject("company:" + userId);
log.info("企业对象是{}:", JSONObject.toJSONString(firmInfoCache));
if (firmInfoCache == null) {
log.error("[鉴权异常处理]请求路径:{}", exchange.getRequest().getPath());
return ServletUtils.webFluxResponseWriter(exchange.getResponse(), "您还未进行企业认证", HttpStatus.UNAUTHORIZED);
if (firmInfoCache == null) {
log.error("[鉴权异常处理]请求路径:{}", exchange.getRequest().getPath());
return ServletUtils.webFluxResponseWriter(exchange.getResponse(), "您还未进行企业认证", HttpStatus.UNAUTHORIZED);
}
return chain.filter(exchange);
}
return chain.filter(exchange);
}
}