实名认证提取魔法数字
This commit is contained in:
parent
21ac49f83c
commit
dfdabcbe1c
@ -43,6 +43,8 @@ public interface GlobalConstants {
|
||||
|
||||
String STATUS_FIVE = "5";
|
||||
|
||||
String REALNAME_VERIFY_SUCCESS_CODE = "10000";
|
||||
|
||||
// LONG 型常量
|
||||
Long LONG_MINUS_ONE = -1L;
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import com.cdp.product.security.exception.DecryptFailureException;
|
||||
import com.cdp.product.security.exception.EncryptFailureException;
|
||||
import com.cdp.product.security.exception.SignFailureException;
|
||||
import com.cdp.product.security.strategyImpl.SM2StrategyImpl;
|
||||
import com.cdzy.common.enums.GlobalConstants;
|
||||
import com.cdzy.common.ex.EbikeException;
|
||||
import com.cdzy.common.secure.SecureComponent;
|
||||
import com.cdzy.common.secure.SecureSM2Component;
|
||||
@ -37,7 +38,11 @@ import javax.crypto.spec.SecretKeySpec;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.Security;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
/**
|
||||
* 验证工具类
|
||||
@ -89,7 +94,7 @@ public class VerifyUtil {
|
||||
/**
|
||||
* 微信工具类构造函数。
|
||||
*/
|
||||
public VerifyUtil(){
|
||||
public VerifyUtil() {
|
||||
client = new OkHttpClient();
|
||||
securityContext = new SecurityContext();
|
||||
//设置加解密上下⽂类调⽤SM2加解密类
|
||||
@ -183,10 +188,10 @@ public class VerifyUtil {
|
||||
throw new EbikeException("验证用户实名失败");
|
||||
}
|
||||
String code = result.has("code") ? result.get("code").asText() : "";
|
||||
if (!"10000".equals(code)) {
|
||||
if (!GlobalConstants.REALNAME_VERIFY_SUCCESS_CODE.equals(code)) {
|
||||
String message = result.has("message") ? result.get("message").asText() : "未知错误";
|
||||
log.error("验证用户实名失败, code: {}, message: {}", code, message);
|
||||
throw new EbikeException(message.replace("(","").replace(")",""));
|
||||
throw new EbikeException(message.replace("(", "").replace(")", ""));
|
||||
}
|
||||
// 3. 解密并解析结果
|
||||
String data = securityContext.decrypt(result.get("data").asText(), realNameVerifyConfig.getClientPrivateKey());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user