Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
smart_gov_platform
Commits
fc7baa17
Commit
fc7baa17
authored
Jul 09, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加门户license验证
parent
6743cb05
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
5 deletions
+10
-5
portal-manager/src/main/java/com/mortals/xhx/common/utils/CipherUtil.java
...rc/main/java/com/mortals/xhx/common/utils/CipherUtil.java
+1
-1
portal-manager/src/main/java/com/mortals/xhx/common/utils/LicenseUtil.java
...c/main/java/com/mortals/xhx/common/utils/LicenseUtil.java
+8
-3
portal-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/DemoStartedService.java
...als/xhx/daemon/applicationservice/DemoStartedService.java
+1
-1
No files found.
portal-manager/src/main/java/com/mortals/xhx/common/utils/CipherUtil.java
View file @
fc7baa17
...
@@ -86,7 +86,7 @@ public class CipherUtil {
...
@@ -86,7 +86,7 @@ public class CipherUtil {
LinkedHashSet
<
String
>
ipv4
=
NetUtil
.
localIpv4s
();
LinkedHashSet
<
String
>
ipv4
=
NetUtil
.
localIpv4s
();
// InetAddress localHost = InetAddress.getLocalHost();
// 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());
// log.info("macAddress:{} IP:{},HostName:{}", macAddress, localHost.getHostAddress(), localHost.getHostName());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"获取网卡信息失败"
,
e
);
log
.
error
(
"获取网卡信息失败"
,
e
);
...
...
portal-manager/src/main/java/com/mortals/xhx/common/utils/LicenseUtil.java
View file @
fc7baa17
package
com.mortals.xhx.common.utils
;
package
com.mortals.xhx.common.utils
;
import
cn.hutool.core.date.DateUtil
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.exception.AppException
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.FileUtils
;
...
@@ -91,12 +92,16 @@ public class LicenseUtil {
...
@@ -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();
long compareTime = CompareTimeUtil.getCompareTime();
// 判断授权时间
// 判断授权时间
if (compareTime >= endTime || compareTime < startTime) {
if (compareTime >= endTime || compareTime < startTime) {
throw new AppException("授权时间无效!");
throw new AppException("授权时间无效!");
}
}
*/
*/
// 验证授权码是否正确
// 验证授权码是否正确
...
@@ -108,15 +113,15 @@ public class LicenseUtil {
...
@@ -108,15 +113,15 @@ public class LicenseUtil {
// String applicationInfo = CipherUtil.getApplicationInfo();
// 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
(
"授权码不匹配!"
);
throw
new
AppException
(
"授权码不匹配!"
);
}
}
return
paramMap
;
return
paramMap
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"授权异常"
,
e
);
log
.
error
(
"授权异常
:
"
,
e
);
try
{
try
{
writeErrorToFile
(
e
,
errorPath
);
writeErrorToFile
(
e
,
errorPath
);
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
...
...
portal-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/DemoStartedService.java
View file @
fc7baa17
...
@@ -56,7 +56,7 @@ public class DemoStartedService implements IApplicationStartedService {
...
@@ -56,7 +56,7 @@ public class DemoStartedService implements IApplicationStartedService {
log
.
info
(
"macAddress:"
+
macAddress
);
log
.
info
(
"macAddress:"
+
macAddress
);
log
.
info
(
"Ip:"
+
ip
);
log
.
info
(
"Ip:"
+
ip
);
StringBuilder
sb
=
new
StringBuilder
();
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
());
CipherUtil
.
macAndIp
.
add
(
sb
.
toString
());
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment