|
|
@@ -1,7 +1,9 @@
|
|
1
|
1
|
package com.ruoyi.wisdomarbitrate.service.impl;
|
|
2
|
2
|
|
|
3
|
|
-import com.alibaba.fastjson2.JSON;
|
|
4
|
|
-import com.alibaba.fastjson2.JSONObject;
|
|
|
3
|
+
|
|
|
4
|
+
|
|
|
5
|
+import com.alibaba.fastjson.JSON;
|
|
|
6
|
+import com.alibaba.fastjson.JSONObject;
|
|
5
|
7
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
6
|
8
|
import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
|
|
7
|
9
|
import com.ruoyi.wisdomarbitrate.mapper.IdentityAuthenticationMapper;
|
|
|
@@ -11,9 +13,9 @@ import com.tencentcloudapi.common.Credential;
|
|
11
|
13
|
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
|
12
|
14
|
import com.tencentcloudapi.common.profile.ClientProfile;
|
|
13
|
15
|
import com.tencentcloudapi.common.profile.HttpProfile;
|
|
14
|
|
-import com.tencentcloudapi.ocr.v20181119.OcrClient;
|
|
15
|
|
-import com.tencentcloudapi.ocr.v20181119.models.RecognizeTableAccurateOCRRequest;
|
|
16
|
|
-import com.tencentcloudapi.ocr.v20181119.models.RecognizeTableAccurateOCRResponse;
|
|
|
16
|
+import com.tencentcloudapi.faceid.v20180301.FaceidClient;
|
|
|
17
|
+import com.tencentcloudapi.faceid.v20180301.models.GetEidTokenRequest;
|
|
|
18
|
+import com.tencentcloudapi.faceid.v20180301.models.GetEidTokenResponse;
|
|
17
|
19
|
import org.slf4j.Logger;
|
|
18
|
20
|
import org.slf4j.LoggerFactory;
|
|
19
|
21
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -32,6 +34,11 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthenticatio
|
|
32
|
34
|
private String credentialSecretId;
|
|
33
|
35
|
@Value("${identityAuthentication.credentialSecretKey}")
|
|
34
|
36
|
private String credentialSecretKey;
|
|
|
37
|
+ @Value("${identityAuthentication.merchantId}")
|
|
|
38
|
+ private String merchantId;
|
|
|
39
|
+
|
|
|
40
|
+// private static final String SECRET_ID = "AKIDeEf2A8uX1HSainvvnXAc3X9ZlhtyvkMp";
|
|
|
41
|
+// private static final String SECRET_KEY = "QjphKo8zkHZigT8j9PVtFPJyfIvO3d6V";
|
|
35
|
42
|
|
|
36
|
43
|
@Autowired
|
|
37
|
44
|
private IdentityAuthenticationMapper identityAuthenticationMapper;
|
|
|
@@ -53,6 +60,35 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthenticatio
|
|
53
|
60
|
|
|
54
|
61
|
}
|
|
55
|
62
|
|
|
|
63
|
+ @Override
|
|
|
64
|
+ public IdentityAuthentication selectIdentityAuthenticaEIDtoken() {
|
|
|
65
|
+ IdentityAuthentication identityAuthentication = new IdentityAuthentication();
|
|
|
66
|
+ try{
|
|
|
67
|
+ // Credential credIdenAuth = new Credential(SECRET_ID, SECRET_KEY);
|
|
|
68
|
+ Credential authenti = new Credential(credentialSecretId, credentialSecretKey);
|
|
|
69
|
+ HttpProfile httpProfileIdenAuth = new HttpProfile();
|
|
|
70
|
+ httpProfileIdenAuth.setEndpoint("faceid.tencentcloudapi.com");
|
|
|
71
|
+ ClientProfile clientInv= new ClientProfile();
|
|
|
72
|
+ clientInv.setHttpProfile(httpProfileIdenAuth);
|
|
|
73
|
+ FaceidClient clientIdenAuth = new FaceidClient(authenti, "", clientInv);
|
|
|
74
|
+ // 实例化一个请求对象
|
|
|
75
|
+ GetEidTokenRequest reqest = new GetEidTokenRequest();
|
|
|
76
|
+ //设置请求参数
|
|
|
77
|
+ reqest.setMerchantId(merchantId);
|
|
|
78
|
+ GetEidTokenResponse respIdenAuth = clientIdenAuth.GetEidToken(reqest);
|
|
|
79
|
+ String respJSON = GetEidTokenResponse.toJsonString(respIdenAuth);
|
|
|
80
|
+ JSONObject objJSON = JSON.parseObject(respJSON);
|
|
|
81
|
+ JSONObject objJSONRes = (JSONObject) objJSON.get("Response");
|
|
|
82
|
+ String eidToken = objJSONRes.getString("EidToken");
|
|
|
83
|
+ String requestId = objJSONRes.getString("RequestId");
|
|
|
84
|
+ identityAuthentication.setEidToken(eidToken);
|
|
|
85
|
+ }catch (TencentCloudSDKException e) {
|
|
|
86
|
+ System.out.println(e.toString());
|
|
|
87
|
+ }
|
|
|
88
|
+
|
|
|
89
|
+ return identityAuthentication;
|
|
|
90
|
+
|
|
|
91
|
+ }
|
|
56
|
92
|
|
|
57
|
93
|
|
|
58
|
94
|
}
|