优化身份认证接口 #43
+10
-30
@@ -14,15 +14,14 @@ import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.IdentityAuthenticationMapper;
|
||||
import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
|
||||
import com.ruoyi.wisdomarbitrate.service.IdentityAuthenticationService;
|
||||
|
||||
import com.tencentcloudapi.common.Credential;
|
||||
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
||||
import com.tencentcloudapi.common.profile.ClientProfile;
|
||||
import com.tencentcloudapi.common.profile.HttpProfile;
|
||||
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
||||
import com.tencentcloudapi.faceid.v20180301.FaceidClient;
|
||||
import com.tencentcloudapi.faceid.v20180301.models.GetEidResultRequest;
|
||||
import com.tencentcloudapi.faceid.v20180301.models.GetEidResultResponse;
|
||||
import com.tencentcloudapi.faceid.v20180301.models.GetEidTokenRequest;
|
||||
import com.tencentcloudapi.faceid.v20180301.models.GetEidTokenResponse;
|
||||
import com.tencentcloudapi.faceid.v20180301.models.*;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -134,14 +133,7 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthenticatio
|
||||
IdentityAuthenticationRespon.setUserId(userId);
|
||||
|
||||
JSONObject objEidInfo = JSON.parseObject(objJSON.getString("EidInfo"));
|
||||
String desKey = objEidInfo.getString("DesKey");
|
||||
String uerInfo = objEidInfo.getString("UserInfo");
|
||||
Map<String,String> mapEidInfo = decodeEidInfo(desKey,uerInfo);
|
||||
IdentityAuthenticationRespon.setName(mapEidInfo.get("name"));
|
||||
IdentityAuthenticationRespon.setIdentityNo(mapEidInfo.get("identityNo"));
|
||||
IdentityAuthenticationRespon.setCertificationStatus(1);
|
||||
|
||||
identityAuthenticationMapper.insertIdentityAuthentication(IdentityAuthenticationRespon);
|
||||
// identityAuthenticationMapper.insertIdentityAuthentication(IdentityAuthenticationRespon);
|
||||
IdentityAuthenticationResult.setCertificationStatus(1);
|
||||
IdentityAuthenticationResult.setCertificationStatusName("认证成功");
|
||||
} catch (TencentCloudSDKException e) {
|
||||
@@ -153,23 +145,11 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthenticatio
|
||||
return IdentityAuthenticationResult;
|
||||
}
|
||||
|
||||
private Map<String, String> decodeEidInfo(String desKey, String uerInfo) {
|
||||
Map<String, String> mapEidInfo = new HashMap<>();
|
||||
byte[] deskeybyts = Base64.getDecoder().decode(desKey);
|
||||
final SM2 sm2crypt = new SM2(privateKeyHexDecodeinfo, null, null);
|
||||
sm2crypt.usePlainEncoding();
|
||||
byte[] sm4keybys = sm2crypt.decrypt(deskeybyts);
|
||||
SymmetricCrypto sm4dcrypt = SmUtil.sm4(sm4keybys);
|
||||
byte[] uerInfobytes = sm4dcrypt.decrypt(Base64.getDecoder().decode(uerInfo));
|
||||
JSONObject objuerInfo = JSON.parseObject(new String(uerInfobytes));
|
||||
String name = objuerInfo.getString("name");
|
||||
mapEidInfo.put("name",name);
|
||||
String idtype = objuerInfo.getString("idtype");
|
||||
mapEidInfo.put("identitytype",idtype);
|
||||
String idnum = objuerInfo.getString("idnum");
|
||||
mapEidInfo.put("identityNo",idnum);
|
||||
return mapEidInfo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user