|
@@ -148,26 +148,27 @@ public class GeoHazardMonitorTokenController {
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("data", "客户端编号不能为空");
|
|
jsonObject.put("data", "客户端编号不能为空");
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), svcAddress.getClientSecret());
|
|
|
|
|
|
+ return JSONObject.toJSONString(jsonObject);
|
|
}
|
|
}
|
|
SvcAddress serviceOne = svcAddressService.getOne(lw);
|
|
SvcAddress serviceOne = svcAddressService.getOne(lw);
|
|
if (!ObjectUtils.isEmpty(serviceOne)) {
|
|
if (!ObjectUtils.isEmpty(serviceOne)) {
|
|
String clientSecret = SM4Utils.decryptData_ECB(serviceOne.getClientSecret(), KEY);
|
|
String clientSecret = SM4Utils.decryptData_ECB(serviceOne.getClientSecret(), KEY);
|
|
- if (clientSecret.equals(svcAddress.getClientSecret())) {
|
|
|
|
|
|
+ String sm4 = SM4Utils.decryptData_ECB(svcAddress.getClientSecret(), clientSecret);
|
|
|
|
+ if (clientSecret.equals(sm4)) {
|
|
if (!ObjectUtils.isEmpty(svcAddress.getGrantType())) {
|
|
if (!ObjectUtils.isEmpty(svcAddress.getGrantType())) {
|
|
if (!svcAddress.getGrantType().toString().matches(PATTERNS)) {
|
|
if (!svcAddress.getGrantType().toString().matches(PATTERNS)) {
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("data", "授权类型填写错误");
|
|
jsonObject.put("data", "授权类型填写错误");
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), svcAddress.getClientSecret());
|
|
|
|
|
|
+ return JSONObject.toJSONString(jsonObject);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("data", "授权类型不能为空");
|
|
jsonObject.put("data", "授权类型不能为空");
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), svcAddress.getClientSecret());
|
|
|
|
|
|
+ return JSONObject.toJSONString(jsonObject);
|
|
}
|
|
}
|
|
- ArrayList<String> objects = apiTokenUtils.createGeoHazardMonitorToken(svcAddress.getGrantType().toString(), svcAddress.getClientId(), svcAddress.getClientSecret());
|
|
|
|
|
|
+ ArrayList<String> objects = apiTokenUtils.createGeoHazardMonitorToken(svcAddress.getGrantType().toString(), svcAddress.getClientId(), sm4);
|
|
if (objects.size() > 0) {
|
|
if (objects.size() > 0) {
|
|
RespGeoHazardMonitorVo respGeoHazardMonitorVo = new RespGeoHazardMonitorVo();
|
|
RespGeoHazardMonitorVo respGeoHazardMonitorVo = new RespGeoHazardMonitorVo();
|
|
respGeoHazardMonitorVo.setAccessToken(objects.get(1));
|
|
respGeoHazardMonitorVo.setAccessToken(objects.get(1));
|
|
@@ -177,12 +178,12 @@ public class GeoHazardMonitorTokenController {
|
|
jsonObject.put("resultCode", 1);
|
|
jsonObject.put("resultCode", 1);
|
|
jsonObject.put("message", "ok");
|
|
jsonObject.put("message", "ok");
|
|
jsonObject.put("data", respGeoHazardMonitorVo);
|
|
jsonObject.put("data", respGeoHazardMonitorVo);
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), svcAddress.getClientSecret());
|
|
|
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), sm4);
|
|
} else {
|
|
} else {
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("message", "失败");
|
|
jsonObject.put("data", "生成token失败");
|
|
jsonObject.put("data", "生成token失败");
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), svcAddress.getClientSecret());
|
|
|
|
|
|
+ return JSONObject.toJSONString(jsonObject);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("resultCode", 0);
|