| | |
| | | package com.ruoyi.gateway.filter; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.common.core.constant.CacheConstants; |
| | | import com.ruoyi.common.core.constant.HttpStatus; |
| | |
| | | @Component |
| | | public class SignFilter implements GlobalFilter, Ordered { |
| | | private static final Logger log = LoggerFactory.getLogger(SignFilter.class); |
| | | |
| | | // 排除过滤的 uri 地址,nacos自行添加 |
| | | @Autowired |
| | | private IgnoreWhiteProperties ignoreWhite; |
| | | |
| | | @Autowired |
| | | private RedisService redisService; |
| | | |
| | | @Value("${security.sign}") |
| | | private boolean parameter_signature; |
| | |
| | | // 构造签名键值对的格式 |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (String k : keySet) { |
| | | Object o = params.get(k); |
| | | if(o instanceof JSONObject || o instanceof JSONArray){ |
| | | continue; |
| | | } |
| | | String v = params.getString(k); |
| | | if(StringUtils.isNotEmpty(v)){ |
| | | sb.append(k + "=" + v + "&"); |