Commit fc7baa17 authored by 赵啸非's avatar 赵啸非

添加门户license验证

parent 6743cb05
......@@ -86,7 +86,7 @@ public class CipherUtil {
LinkedHashSet<String> ipv4 = NetUtil.localIpv4s();
// InetAddress localHost = InetAddress.getLocalHost();
sb.append("mac=").append(macAddress).append("&ip=").append(NetUtil.getLocalhost().getHostAddress());
sb.append("mac=").append(macAddress).append("|ip=").append(NetUtil.getLocalhost().getHostAddress());
// log.info("macAddress:{} IP:{},HostName:{}", macAddress, localHost.getHostAddress(), localHost.getHostName());
} catch (Exception e) {
log.error("获取网卡信息失败", e);
......
package com.mortals.xhx.common.utils;
import cn.hutool.core.date.DateUtil;
import com.mortals.framework.exception.AppException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
......@@ -91,12 +92,16 @@ public class LicenseUtil {
}
// 获取授权比较时间
boolean in = DateUtil.isIn(new Date(), DateUtil.date(startTime), DateUtil.date(endTime));
if(!in) throw new AppException("授权时间无效!");
/*
long compareTime = CompareTimeUtil.getCompareTime();
// 判断授权时间
if (compareTime >= endTime || compareTime < startTime) {
throw new AppException("授权时间无效!");
}
*/
// 验证授权码是否正确
......@@ -108,15 +113,15 @@ public class LicenseUtil {
// String applicationInfo = CipherUtil.getApplicationInfo();
// 对授权码进行解密
String encryptData = DecodeUtil.decryptBySymmetry(licenseCode, DecodeUtil.AES_KEY, DecodeUtil.AES, true);
// String encryptData = DecodeUtil.decryptBySymmetry(licenseCode, DecodeUtil.AES_KEY, DecodeUtil.AES, true);
// 对授权码进行与硬件信息编码进行匹配
if (!macAndIpSet.contains(encryptData)) {
if (!macAndIpSet.contains(licenseCode)) {
throw new AppException("授权码不匹配!");
}
return paramMap;
} catch (Exception e) {
log.error("授权异常", e);
log.error("授权异常:", e);
try {
writeErrorToFile(e, errorPath);
} catch (IOException ex) {
......
......@@ -56,7 +56,7 @@ public class DemoStartedService implements IApplicationStartedService {
log.info("macAddress:" + macAddress);
log.info("Ip:" + ip);
StringBuilder sb = new StringBuilder();
sb.append("mac=").append(macAddress).append("&ip=").append(ip);
sb.append("mac=").append(macAddress).append("|ip=").append(ip);
CipherUtil.macAndIp.add(sb.toString());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment