Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
loginservice
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanmw
loginservice
Commits
7510b97d
Commit
7510b97d
authored
Mar 02, 2026
by
linxu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加license校验
parent
9cf7e21b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
4 deletions
+47
-4
LicenseMgr.java
src/main/java/com/keymobile/sso/conf/LicenseMgr.java
+43
-0
RESTAuthenticationSuccessHandler.java
.../keymobile/sso/conf/RESTAuthenticationSuccessHandler.java
+1
-1
SystemVariable.java
src/main/java/com/keymobile/sso/conf/SystemVariable.java
+3
-3
No files found.
src/main/java/com/keymobile/sso/conf/LicenseMgr.java
0 → 100644
View file @
7510b97d
package
com
.
keymobile
.
sso
.
conf
;
import
com.keymobile.crypto.aes.AESUtil
;
import
com.keymobile.sso.logging.LogConstants
;
import
com.keymobile.sso.logging.LogManager
;
import
javax.crypto.BadPaddingException
;
import
javax.crypto.IllegalBlockSizeException
;
import
javax.crypto.NoSuchPaddingException
;
import
javax.crypto.SecretKey
;
import
javax.crypto.spec.IvParameterSpec
;
import
javax.crypto.spec.SecretKeySpec
;
import
java.security.InvalidAlgorithmParameterException
;
import
java.security.InvalidKeyException
;
import
java.security.NoSuchAlgorithmException
;
import
java.time.LocalDate
;
import
java.util.Base64
;
public
class
LicenseMgr
{
public
static
String
generate
(
String
expiredDate
)
throws
InvalidAlgorithmParameterException
,
NoSuchPaddingException
,
IllegalBlockSizeException
,
NoSuchAlgorithmException
,
BadPaddingException
,
InvalidKeyException
{
SecretKey
secretKey
=
new
SecretKeySpec
(
Base64
.
getDecoder
().
decode
(
"NCXgEu++tYgACfaC0zt7E+Ti5CR4AZ3NkTVhfvsgEjc="
),
"AES"
);
IvParameterSpec
ivParameterSpec
=
new
IvParameterSpec
(
Base64
.
getDecoder
().
decode
(
"2w6UWLMm0Om7fCAfpfkyeA=="
));
return
AESUtil
.
encryptPasswordBased
(
expiredDate
,
secretKey
,
ivParameterSpec
);
}
public
static
void
check
(
String
licenseText
)
throws
InvalidAlgorithmParameterException
,
NoSuchPaddingException
,
IllegalBlockSizeException
,
NoSuchAlgorithmException
,
BadPaddingException
,
InvalidKeyException
{
SecretKey
secretKey
=
new
SecretKeySpec
(
Base64
.
getDecoder
().
decode
(
"NCXgEu++tYgACfaC0zt7E+Ti5CR4AZ3NkTVhfvsgEjc="
),
"AES"
);
IvParameterSpec
ivParameterSpec
=
new
IvParameterSpec
(
Base64
.
getDecoder
().
decode
(
"2w6UWLMm0Om7fCAfpfkyeA=="
));
String
expiredDate
=
AESUtil
.
decryptPasswordBased
(
licenseText
,
secretKey
,
ivParameterSpec
);
LocalDate
expired
=
LocalDate
.
parse
(
expiredDate
);
System
.
out
.
println
(
"License will expire at "
+
expiredDate
+
"."
);
}
public
static
void
main
(
String
[]
args
)
throws
InvalidAlgorithmParameterException
,
NoSuchPaddingException
,
IllegalBlockSizeException
,
NoSuchAlgorithmException
,
BadPaddingException
,
InvalidKeyException
{
String
licenseText
=
generate
(
"2025-09-01"
);
System
.
out
.
println
(
"licenseText:"
+
licenseText
);
check
(
licenseText
);
}
}
src/main/java/com/keymobile/sso/conf/RESTAuthenticationSuccessHandler.java
View file @
7510b97d
...
@@ -36,7 +36,7 @@ public class RESTAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuc
...
@@ -36,7 +36,7 @@ public class RESTAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuc
returnStatus
=
"root not allow login"
;
returnStatus
=
"root not allow login"
;
}
}
if
(!
SystemVariable
.
isDisableLicen
c
eCheck
())
{
if
(!
SystemVariable
.
isDisableLicen
s
eCheck
())
{
try
{
try
{
if
(!
licenseChecker
.
check
())
{
if
(!
licenseChecker
.
check
())
{
returnStatus
=
"license expired"
;
returnStatus
=
"license expired"
;
...
...
src/main/java/com/keymobile/sso/conf/SystemVariable.java
View file @
7510b97d
...
@@ -8,16 +8,16 @@ public class SystemVariable {
...
@@ -8,16 +8,16 @@ public class SystemVariable {
private
static
String
licenseFileName
=
""
;
private
static
String
licenseFileName
=
""
;
static
{
static
{
disableLicenceCheck
=
System
.
getProperty
(
"disableLicen
c
eCheck"
);
disableLicenceCheck
=
System
.
getProperty
(
"disableLicen
s
eCheck"
);
licenseFileName
=
System
.
getProperty
(
"licenseFile"
);
licenseFileName
=
System
.
getProperty
(
"licenseFile"
);
System
.
out
.
println
(
"------------ SSO Global Settings ------------"
);
System
.
out
.
println
(
"------------ SSO Global Settings ------------"
);
System
.
out
.
println
(
"disableLicen
ceCheck:"
+
isDisableLicenc
eCheck
());
System
.
out
.
println
(
"disableLicen
seCheck:"
+
isDisableLicens
eCheck
());
System
.
out
.
println
(
"licenseFile:"
+
getLicenseFileName
());
System
.
out
.
println
(
"licenseFile:"
+
getLicenseFileName
());
System
.
out
.
println
(
"-----------------------------------------------------"
);
System
.
out
.
println
(
"-----------------------------------------------------"
);
}
}
public
static
boolean
isDisableLicen
c
eCheck
()
{
public
static
boolean
isDisableLicen
s
eCheck
()
{
if
(
StringUtils
.
isNotEmpty
(
disableLicenceCheck
)
&&
disableLicenceCheck
.
equals
(
"true"
))
{
if
(
StringUtils
.
isNotEmpty
(
disableLicenceCheck
)
&&
disableLicenceCheck
.
equals
(
"true"
))
{
return
true
;
return
true
;
}
}
...
...
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