【fix sonar】SignUtil文件
This commit is contained in:
+11
-4
@@ -1,5 +1,6 @@
|
||||
package com.jero.config.sign.util;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
@@ -8,18 +9,24 @@ import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.config.StaticConfig;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import java.util.SortedMap;
|
||||
|
||||
/**
|
||||
* 签名工具类
|
||||
*
|
||||
*
|
||||
* @author jeecg
|
||||
* @date 20210621
|
||||
*/
|
||||
@Slf4j
|
||||
public class SignUtil {
|
||||
public static final String xPathVariable = "x-path-variable";
|
||||
|
||||
private SignUtil(){
|
||||
|
||||
}
|
||||
|
||||
public static final String X_PATH_VARIABLE = "x-path-variable";
|
||||
|
||||
/**
|
||||
* @param params
|
||||
@@ -44,7 +51,7 @@ public class SignUtil {
|
||||
public static String getParamsSign(SortedMap<String, String> params) {
|
||||
//去掉 Url 里的时间戳
|
||||
params.remove("_t");
|
||||
String paramsJsonStr = JSONObject.toJSONString(params);
|
||||
String paramsJsonStr = JSON.toJSONString(params);
|
||||
log.info("Param paramsJsonStr : {}", paramsJsonStr);
|
||||
StaticConfig staticConfig = SpringContextUtils.getBean(StaticConfig.class);
|
||||
String signatureSecret = staticConfig.getSignatureSecret();
|
||||
@@ -53,4 +60,4 @@ public class SignUtil {
|
||||
}
|
||||
return DigestUtils.md5DigestAsHex((paramsJsonStr + signatureSecret).getBytes()).toUpperCase();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user