refactor(license): 优化 License 模块部分代码

This commit is contained in:
2025-04-29 22:31:36 +08:00
parent 06f5a0f346
commit 7d97026480
35 changed files with 350 additions and 473 deletions

View File

@@ -16,12 +16,229 @@
<dependencyManagement>
<dependencies>
<!-- 扩展模块 - CRUD - 核心模块 -->
<!-- 核心模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-extension-crud-core</artifactId>
<artifactId>continew-starter-core</artifactId>
<version>${revision}</version>
</dependency>
<!-- JSON 模块 - Jackson -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-json-jackson</artifactId>
<version>${revision}</version>
</dependency>
<!-- API 文档模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-api-doc</artifactId>
<version>${revision}</version>
</dependency>
<!-- Web 模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-web</artifactId>
<version>${revision}</version>
</dependency>
<!-- 认证模块 - SaToken -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-auth-satoken</artifactId>
<version>${revision}</version>
</dependency>
<!-- 认证模块 - JustAuth -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-auth-justauth</artifactId>
<version>${revision}</version>
</dependency>
<!-- 数据访问模块 - MyBatis Plus -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-data-mp</artifactId>
<version>${revision}</version>
</dependency>
<!-- 数据访问模块 - MyBatis Flex -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-data-mf</artifactId>
<version>${revision}</version>
</dependency>
<!-- 数据访问模块 - 核心模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-data-core</artifactId>
<version>${revision}</version>
</dependency>
<!-- 缓存模块 - Redisson -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-cache-redisson</artifactId>
<version>${revision}</version>
</dependency>
<!-- 缓存模块 - Spring Cache -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-cache-springcache</artifactId>
<version>${revision}</version>
</dependency>
<!-- 缓存模块 - JetCache -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-cache-jetcache</artifactId>
<version>${revision}</version>
</dependency>
<!-- 安全模块 - 密码编码器 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-security-password</artifactId>
<version>${revision}</version>
</dependency>
<!-- 安全模块 - 加密 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-security-crypto</artifactId>
<version>${revision}</version>
</dependency>
<!-- 安全模块 - 脱敏 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-security-mask</artifactId>
<version>${revision}</version>
</dependency>
<!-- 安全模块 - XSS 过滤 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-security-xss</artifactId>
</dependency>
<!-- 安全模块 - 敏感词 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-security-sensitivewords</artifactId>
<version>${revision}</version>
</dependency>
<!-- 限流模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-ratelimiter</artifactId>
<version>${revision}</version>
</dependency>
<!-- 幂等模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-idempotent</artifactId>
<version>${revision}</version>
</dependency>
<!-- 链路追踪模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-trace</artifactId>
<version>${revision}</version>
</dependency>
<!-- 验证码模块 - 图形验证码 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-captcha-graphic</artifactId>
<version>${revision}</version>
</dependency>
<!-- 验证码模块 - 行为验证码 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-captcha-behavior</artifactId>
<version>${revision}</version>
</dependency>
<!-- 消息模块 - 邮件 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-messaging-mail</artifactId>
<version>${revision}</version>
</dependency>
<!-- 消息模块 - WebSocket -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-messaging-websocket</artifactId>
<version>${revision}</version>
</dependency>
<!-- 日志模块 - 基于拦截器实现Spring Boot Actuator HttpTrace 增强版) -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-log-interceptor</artifactId>
<version>${revision}</version>
</dependency>
<!-- 日志模块 - 基于 AOP 实现 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-log-aop</artifactId>
<version>${revision}</version>
</dependency>
<!-- 日志模块 - 核心模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-log-core</artifactId>
<version>${revision}</version>
</dependency>
<!-- 文件处理模块 - Excel -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-file-excel</artifactId>
<version>${revision}</version>
</dependency>
<!-- 存储模块 - 本地存储 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-storage-local</artifactId>
<version>${revision}</version>
</dependency>
<!-- 存储模块 - 对象存储 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-storage-oss</artifactId>
<version>${revision}</version>
</dependency>
<!-- 存储模块 - 核心模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-storage-core</artifactId>
<version>${revision}</version>
</dependency>
<!-- License 模块 - 生成器 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-license-generator</artifactId>
<version>${revision}</version>
</dependency>
<!-- License 模块 - 校验器 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-license-verifier</artifactId>
<version>${revision}</version>
</dependency>
<!-- License 模块 - 核心模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-license-core</artifactId>
<version>${revision}</version>
</dependency>
<!-- 扩展模块 - CRUD - MyBatis Plus ORM 模块 -->
<dependency>
<groupId>top.continew</groupId>
@@ -34,267 +251,36 @@
<artifactId>continew-starter-extension-crud-mf</artifactId>
<version>${revision}</version>
</dependency>
<!-- 扩展模块 - 数据权限 - 核心模块 -->
<!-- 扩展模块 - CRUD - 核心模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-extension-datapermission-core</artifactId>
<artifactId>continew-starter-extension-crud-core</artifactId>
<version>${revision}</version>
</dependency>
<!-- 扩展模块 - 数据权限 - MyBatis Plus ORM 模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-extension-datapermission-mp</artifactId>
<version>${revision}</version>
</dependency>
<!-- 扩展模块 - 多租户 - 核心模块 -->
<!-- 扩展模块 - 数据权限 - 核心模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-extension-tenant-core</artifactId>
<artifactId>continew-starter-extension-datapermission-core</artifactId>
<version>${revision}</version>
</dependency>
<!-- 扩展模块 - 多租户 - MyBatis Plus ORM 模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-extension-tenant-mp</artifactId>
<version>${revision}</version>
</dependency>
<!-- 认证模块 - JustAuth -->
<!-- 扩展模块 - 多租户 - 核心模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-auth-justauth</artifactId>
<version>${revision}</version>
</dependency>
<!-- 认证模块 - SaToken -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-auth-satoken</artifactId>
<version>${revision}</version>
</dependency>
<!-- 数据访问模块 - MyBatis Plus -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-data-mp</artifactId>
<version>${revision}</version>
</dependency>
<!-- 数据访问模块 - MyBatis Flex -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-data-mf</artifactId>
<version>${revision}</version>
</dependency>
<!-- 数据访问模块 - 核心模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-data-core</artifactId>
<version>${revision}</version>
</dependency>
<!-- 缓存模块 - JetCache -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-cache-jetcache</artifactId>
<version>${revision}</version>
</dependency>
<!-- 缓存模块 - Spring Cache -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-cache-springcache</artifactId>
<version>${revision}</version>
</dependency>
<!-- 缓存模块 - Redisson -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-cache-redisson</artifactId>
<version>${revision}</version>
</dependency>
<!-- 消息模块 - WebSocket -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-messaging-websocket</artifactId>
<version>${revision}</version>
</dependency>
<!-- 消息模块 - 邮件 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-messaging-mail</artifactId>
<version>${revision}</version>
</dependency>
<!-- 验证码模块 - 行为验证码 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-captcha-behavior</artifactId>
<version>${revision}</version>
</dependency>
<!-- 验证码模块 - 图形验证码 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-captcha-graphic</artifactId>
<version>${revision}</version>
</dependency>
<!-- 文件处理模块 - Excel -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-file-excel</artifactId>
<version>${revision}</version>
</dependency>
<!-- 存储模块 - 核心模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-storage-core</artifactId>
<version>${revision}</version>
</dependency>
<!-- 存储模块 - 本地存储 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-storage-local</artifactId>
<version>${revision}</version>
</dependency>
<!-- 存储模块 - 对象存储 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-storage-oss</artifactId>
<version>${revision}</version>
</dependency>
<!-- 日志模块 - 基于拦截器实现Spring Boot Actuator HttpTrace 增强版) -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-log-interceptor</artifactId>
<version>${revision}</version>
</dependency>
<!-- 日志模块 - 基于 AOP 实现 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-log-aop</artifactId>
<version>${revision}</version>
</dependency>
<!-- 日志模块 - 核心模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-log-core</artifactId>
<version>${revision}</version>
</dependency>
<!-- 链路追踪模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-trace</artifactId>
<version>${revision}</version>
</dependency>
<!-- 幂等模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-idempotent</artifactId>
<version>${revision}</version>
</dependency>
<!-- 限流模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-ratelimiter</artifactId>
<version>${revision}</version>
</dependency>
<!-- 安全模块 - XSS 过滤 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-security-xss</artifactId>
</dependency>
<!-- 安全模块 - 敏感词 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-security-sensitivewords</artifactId>
<version>${revision}</version>
</dependency>
<!-- 安全模块 - 加密 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-security-crypto</artifactId>
<version>${revision}</version>
</dependency>
<!-- 安全模块 - 脱敏 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-security-mask</artifactId>
<version>${revision}</version>
</dependency>
<!-- 安全模块 - 密码编码器 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-security-password</artifactId>
<version>${revision}</version>
</dependency>
<!-- Web 模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-web</artifactId>
<version>${revision}</version>
</dependency>
<!-- API 文档模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-api-doc</artifactId>
<version>${revision}</version>
</dependency>
<!-- JSON 模块 - Jackson -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-json-jackson</artifactId>
<version>${revision}</version>
</dependency>
<!-- 核心模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-core</artifactId>
<version>${revision}</version>
</dependency>
<!-- license 核心模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-license-core</artifactId>
<version>${revision}</version>
</dependency>
<!-- license 生成模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-license-generate</artifactId>
<version>${revision}</version>
</dependency>
<!-- license 校验模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-license-verify</artifactId>
<artifactId>continew-starter-extension-tenant-core</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>

View File

@@ -13,7 +13,7 @@
<description>ContiNew Starter 缓存模块 - JetCache</description>
<dependencies>
<!-- JetCache一个基于 Java 的缓存系统封装,提供统一的 API 和注解来简化缓存的使用。提供了比 SpringCache 更加强大的注解,可以原生的支持 TTL、两级缓存、分布式自动刷新还提供了 Cache 接口用于手工缓存操作) -->
<!-- JetCache基于 Java 的缓存系统封装,提供统一的 API 和注解来简化缓存的使用。提供了比 SpringCache 更加强大的注解,可以原生的支持 TTL、两级缓存、分布式自动刷新还提供了 Cache 接口用于手工缓存操作) -->
<dependency>
<groupId>com.alicp.jetcache</groupId>
<artifactId>jetcache-autoconfigure</artifactId>

View File

@@ -19,7 +19,7 @@
<artifactId>easy-captcha</artifactId>
</dependency>
<!-- JS 引擎(一个纯编译的 JavaScript 引擎) -->
<!-- JS 引擎(纯编译的 JavaScript 引擎) -->
<dependency>
<groupId>org.openjdk.nashorn</groupId>
<artifactId>nashorn-core</artifactId>

View File

@@ -34,6 +34,21 @@ public class PropertiesConstants {
*/
public static final String ENABLED = "enabled";
/**
* Web 配置
*/
public static final String WEB = CONTINEW_STARTER + StringConstants.DOT + "web";
/**
* Web-跨域配置
*/
public static final String WEB_CORS = WEB + StringConstants.DOT + "cors";
/**
* Web-响应配置
*/
public static final String WEB_RESPONSE = WEB + StringConstants.DOT + "response";
/**
* 安全配置
*/
@@ -60,29 +75,19 @@ public class PropertiesConstants {
public static final String SECURITY_XSS = SECURITY + StringConstants.DOT + "xss";
/**
* Web 配置
* 限流配置
*/
public static final String WEB = CONTINEW_STARTER + StringConstants.DOT + "web";
public static final String RATE_LIMITER = CONTINEW_STARTER + StringConstants.DOT + "rate-limiter";
/**
* Web-跨域配置
* 幂等配置
*/
public static final String WEB_CORS = WEB + StringConstants.DOT + "cors";
public static final String IDEMPOTENT = CONTINEW_STARTER + StringConstants.DOT + "idempotent";
/**
* Web-响应配置
* 链路追踪配置
*/
public static final String WEB_RESPONSE = WEB + StringConstants.DOT + "response";
/**
* 日志配置
*/
public static final String LOG = CONTINEW_STARTER + StringConstants.DOT + "log";
/**
* 存储配置
*/
public static final String STORAGE = CONTINEW_STARTER + StringConstants.DOT + "storage";
public static final String TRACE = CONTINEW_STARTER + StringConstants.DOT + "trace";
/**
* 验证码配置
@@ -109,6 +114,31 @@ public class PropertiesConstants {
*/
public static final String MESSAGING_WEBSOCKET = MESSAGING + StringConstants.DOT + "websocket";
/**
* 日志配置
*/
public static final String LOG = CONTINEW_STARTER + StringConstants.DOT + "log";
/**
* 存储配置
*/
public static final String STORAGE = CONTINEW_STARTER + StringConstants.DOT + "storage";
/**
* License 配置
*/
public static final String LICENSE = CONTINEW_STARTER + StringConstants.DOT + "license";
/**
* License 生成器配置
*/
public static final String LICENSE_GENERATOR = LICENSE + StringConstants.DOT + "generator";
/**
* License 校验器配置
*/
public static final String LICENSE_VERIFIER = LICENSE + StringConstants.DOT + "verifier";
/**
* CRUD 配置
*/
@@ -124,36 +154,6 @@ public class PropertiesConstants {
*/
public static final String TENANT = CONTINEW_STARTER + StringConstants.DOT + "tenant";
/**
* 限流配置
*/
public static final String RATE_LIMITER = CONTINEW_STARTER + StringConstants.DOT + "rate-limiter";
/**
* 幂等配置
*/
public static final String IDEMPOTENT = CONTINEW_STARTER + StringConstants.DOT + "idempotent";
/**
* 链路追踪配置
*/
public static final String TRACE = CONTINEW_STARTER + StringConstants.DOT + "trace";
/**
* license配置
*/
public static final String LICENSE = CONTINEW_STARTER + StringConstants.DOT + "license";
/**
* license 生成模块配置
*/
public static final String LICENSE_GENERATE = LICENSE + StringConstants.DOT + "generate";
/**
* license 校验模块配置
*/
public static final String LICENSE_VERIFY = LICENSE + StringConstants.DOT + "verify";
private PropertiesConstants() {
}
}

View File

@@ -44,14 +44,12 @@
<ip2region.version>3.3.6</ip2region.version>
<hutool.version>5.8.36</hutool.version>
<snakeyaml.version>2.4</snakeyaml.version>
<truelicense.version>1.33</truelicense.version>
<zip4j.version>2.11.5</zip4j.version>
<!-- 解决部分传递依赖漏洞问题 -->
<commons-beanutils.version>1.9.4</commons-beanutils.version>
<commons-io.version>2.17.0</commons-io.version>
<commons-compress.version>1.26.0</commons-compress.version>
<!--license-->
<truelicense.version>1.33</truelicense.version>
<zip4j.version>2.11.5</zip4j.version>
<!-- Maven Plugin Versions -->
<flatten.version>1.7.0</flatten.version>
<spotless.version>2.44.3</spotless.version>
@@ -85,7 +83,7 @@
<version>${redisson.version}</version>
</dependency>
<!-- JetCache一个基于 Java 的缓存系统封装,提供统一的 API 和注解来简化缓存的使用。提供了比 SpringCache 更加强大的注解,可以原生的支持 TTL、两级缓存、分布式自动刷新还提供了 Cache 接口用于手工缓存操作) -->
<!-- JetCache基于 Java 的缓存系统封装,提供统一的 API 和注解来简化缓存的使用。提供了比 SpringCache 更加强大的注解,可以原生的支持 TTL、两级缓存、分布式自动刷新还提供了 Cache 接口用于手工缓存操作) -->
<dependency>
<groupId>com.alicp.jetcache</groupId>
<artifactId>jetcache-bom</artifactId>
@@ -227,14 +225,14 @@
<version>${easy-captcha.version}</version>
</dependency>
<!-- JS 引擎(一个纯编译的 JavaScript 引擎) -->
<!-- JS 引擎(纯编译的 JavaScript 引擎) -->
<dependency>
<groupId>org.openjdk.nashorn</groupId>
<artifactId>nashorn-core</artifactId>
<version>${nashorn.version}</version>
</dependency>
<!-- Easy Excel一个基于 Java 的、快速、简洁、解决大文件内存溢出的 Excel 处理工具) -->
<!-- Easy Excel基于 Java 的、快速、简洁、解决大文件内存溢出的 Excel 处理工具) -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
@@ -283,14 +281,14 @@
<version>${thumbnails.version}</version>
</dependency>
<!-- Graceful Response一个Spring Boot技术栈下的优雅响应处理组件可以帮助开发者完成响应数据封装、异常处理、错误码填充等过程提高开发效率提高代码质量 -->
<!-- Graceful ResponseSpring Boot技术栈下的优雅响应处理组件可以帮助开发者完成响应数据封装、异常处理、错误码填充等过程提高开发效率提高代码质量 -->
<dependency>
<groupId>com.feiniaojin</groupId>
<artifactId>graceful-response</artifactId>
<version>${graceful-response.version}</version>
</dependency>
<!-- Crane4j一个基于注解的,用于完成一切 “根据 A 的 key 值拿到 B再把 B 的属性映射到 A” 这类需求的字段填充框架) -->
<!-- Crane4j基于注解的用于完成一切 “根据 A 的 key 值拿到 B再把 B 的属性映射到 A” 这类需求的字段填充框架) -->
<dependency>
<groupId>cn.crane4j</groupId>
<artifactId>crane4j-spring-boot-starter</artifactId>
@@ -320,7 +318,7 @@
<version>${snakeyaml.version}</version>
</dependency>
<!-- OkHTTP一个默认高效的 HTTP 客户端) -->
<!-- OkHTTP默认高效的 HTTP 客户端) -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
@@ -355,6 +353,19 @@
<version>${hutool.version}</version>
</dependency>
<!-- TrueLicense (开源的证书管理引擎) -->
<dependency>
<groupId>de.schlichtherle.truelicense</groupId>
<artifactId>truelicense-core</artifactId>
<version>${truelicense.version}</version>
</dependency>
<!-- Zip4j (开源的 Java 处理 zip 压缩文件的开发包) -->
<dependency>
<groupId>net.lingala.zip4j</groupId>
<artifactId>zip4j</artifactId>
<version>${zip4j.version}</version>
</dependency>
<!-- 解决部分传递依赖漏洞问题 -->
<dependency>
<groupId>commons-beanutils</groupId>
@@ -374,20 +385,6 @@
<version>${commons-compress.version}</version>
</dependency>
<!-- license 依赖-->
<dependency>
<groupId>de.schlichtherle.truelicense</groupId>
<artifactId>truelicense-core</artifactId>
<version>${truelicense.version}</version>
</dependency>
<!--zip4j压缩文件-->
<dependency>
<groupId>net.lingala.zip4j</groupId>
<artifactId>zip4j</artifactId>
<version>${zip4j.version}</version>
</dependency>
<!-- ContiNew Starter 依赖 -->
<dependency>
<groupId>top.continew</groupId>

View File

@@ -13,7 +13,7 @@
<description>ContiNew Starter 扩展模块 - CRUD增删改查 - 核心模块</description>
<dependencies>
<!-- Crane4j一个基于注解的,用于完成一切 “根据 A 的 key 值拿到 B再把 B 的属性映射到 A” 这类需求的字段填充框架) -->
<!-- Crane4j基于注解的用于完成一切 “根据 A 的 key 值拿到 B再把 B 的属性映射到 A” 这类需求的字段填充框架) -->
<dependency>
<groupId>cn.crane4j</groupId>
<artifactId>crane4j-spring-boot-starter</artifactId>

View File

@@ -13,7 +13,7 @@
<description>ContiNew Starter 文件处理模块 - Excel</description>
<dependencies>
<!-- Easy Excel一个基于 Java 的、快速、简洁、解决大文件内存溢出的 Excel 处理工具) -->
<!-- Easy Excel基于 Java 的、快速、简洁、解决大文件内存溢出的 Excel 处理工具) -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>

View File

@@ -7,27 +7,27 @@
<artifactId>continew-starter-license</artifactId>
<version>${revision}</version>
</parent>
<artifactId>continew-starter-license-core</artifactId>
<description>ContiNew Starter License核心模块</description>
<dependencies>
<!-- continew starter 核心模块 -->
<artifactId>continew-starter-license-core</artifactId>
<description>ContiNew Starter License 模块 - 核心模块</description>
<dependencies>
<!-- 核心模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-core</artifactId>
</dependency>
<!-- license 依赖-->
<!-- TrueLicense (一个开源的证书管理引擎)-->
<dependency>
<groupId>de.schlichtherle.truelicense</groupId>
<artifactId>truelicense-core</artifactId>
</dependency>
<!--zip4j压缩文件-->
<!-- Zip4j (开源的 Java 处理 zip 压缩文件的开发包) -->
<dependency>
<groupId>net.lingala.zip4j</groupId>
<artifactId>zip4j</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -26,7 +26,7 @@ import java.io.Serializable;
*
* @author echo
* @since 2.11.0
**/
*/
public class BuildCreatorResp implements Serializable {
@Serial
@@ -38,7 +38,7 @@ public class BuildCreatorResp implements Serializable {
private LicenseCreatorParam param;
/**
* 客户端zip文件
* 客户端 Zip 文件
*/
private ZipFile clientZipFile;

View File

@@ -21,7 +21,7 @@ package top.continew.license.model;
*
* @author loach
* @since 2.11.0
**/
*/
public class ConfigParam {
/**

View File

@@ -30,6 +30,7 @@ import java.io.InputStream;
* @since 2.11.0
*/
public class CustomKeyStoreParam extends AbstractKeyStoreParam {
/**
* 密钥路径,可为磁盘路径,也可为项目资源文件里的路径,如果为磁盘路径需重写getStream()方法
*/
@@ -50,8 +51,8 @@ public class CustomKeyStoreParam extends AbstractKeyStoreParam {
*/
private String keyPass;
public CustomKeyStoreParam(Class aClass, String s) {
super(aClass, s);
public CustomKeyStoreParam(Class clazz, String s) {
super(clazz, s);
}
public CustomKeyStoreParam(Class clazz, String resource, String alias, String storePass, String keyPass) {

View File

@@ -25,7 +25,7 @@ import java.util.Date;
*
* @author loach
* @since 2.11.0
**/
*/
public class LicenseCreatorParam implements Serializable {
@Serial

View File

@@ -23,7 +23,7 @@ import java.util.Date;
*
* @author loach
* @since 2.11.0
**/
*/
public class LicenseCreatorParamVO {
/**

View File

@@ -23,7 +23,7 @@ import java.util.Set;
*
* @author loach
* @since 2.11.0
**/
*/
public class LicenseExtraModel {
/**

View File

@@ -28,11 +28,14 @@ import java.io.LineNumberReader;
*
* @author loach
* @since 2.11.0
**/
*/
public class ExecCmdUtil {
private static final String CREATE_3RDSESSION_SHELL_SCRIPT = "head -n 80 /dev/urandom | tr -dc A-Za-z0-9 | head -c 168";
private ExecCmdUtil() {
}
/**
* 执行cmd命令(shell脚本)
*
@@ -82,7 +85,6 @@ public class ExecCmdUtil {
* 执行linux命令(shell脚本)生成3rd_session随机数
*/
public static String create3rdSessionToken() throws IOException {
return exec(CREATE_3RDSESSION_SHELL_SCRIPT);
}
}

View File

@@ -52,6 +52,9 @@ public class ServerInfoUtils {
private static String mainBoardSerial = null;
}
private ServerInfoUtils() {
}
/**
* 组装需要额外校验的License参数
*
@@ -324,7 +327,6 @@ public class ServerInfoUtils {
* @throws Exception 默认异常
*/
private static Set<InetAddress> getLocalAllInetAddress() throws Exception {
Set<InetAddress> result = CollUtil.newHashSet();
// 遍历所有的网络接口
for (Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
@@ -342,5 +344,4 @@ public class ServerInfoUtils {
}
return result;
}
}

View File

@@ -1,82 +0,0 @@
## continew-starter-license-generate 使用方法
1. 引入依赖
```java
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-license-generate</artifactId>
<version>2.11.0-SNAPSHOT</version>
</dependency>
```
2. 开发对外接口
```
/*
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package top.continew.admin.controller.license;
import cn.dev33.satoken.annotation.SaIgnore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.continew.license.model.LicenseCreatorParamVO;
import top.continew.license.model.LicenseExtraModel;
import top.continew.license.service.LicenseCreateService;
import java.util.Calendar;
import java.util.Date;
/**
* @Desc:
* @Author loach
* @ClassName top.continew.admin.controller.license.LicenseGenerateController
* @Date 2025-04-15 10:52
*/
@RestController
@RequestMapping("/license")
public class LicenseGenerateController {
@Autowired
private LicenseCreateService licenseCreateService;
@GetMapping("/generate")
public void listDict() throws Exception {
//设置证书校验参数
LicenseCreatorParamVO paramVO = new LicenseCreatorParamVO();
paramVO.setCustomerName("continew");
paramVO.setDescription("continew");
paramVO.setKeyPass("123456a");
paramVO.setStorePass("123456a");
//设置过期时间
Calendar calendar = Calendar.getInstance();
long expire = Instant.now().toEpochMilli() + (24L * 3600L * 1000L);;
// long expire = new Date().getTime() + (24L * 3600L * 1000L);
calendar.setTimeInMillis(expire);
paramVO.setExpireTime(calendar.getTime());
//设置额外校验参数(服务器信息)
LicenseExtraModel extraModel = licenseCreateService.getServerInfo();
paramVO.setLicenseExtraModel(extraModel);
licenseCreateService.generateLicense(paramVO);
}
}
```
注:默认生成 license 为FileUtil.getTmpDirPath()下。将压缩包发送给客户端使用。

View File

@@ -9,16 +9,14 @@
<version>${revision}</version>
</parent>
<artifactId>continew-starter-license-verify</artifactId>
<packaging>jar</packaging>
<description>ContiNew Starter License校验模块</description>
<artifactId>continew-starter-license-generator</artifactId>
<description>ContiNew Starter License 模块 - 生成器</description>
<dependencies>
<!-- license 核心模块 -->
<!-- License 模块 - 核心模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-license-core</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -36,7 +36,7 @@ import top.continew.starter.core.constant.PropertiesConstants;
*/
@AutoConfiguration
@EnableConfigurationProperties(LicenseGenerateProperties.class)
@ConditionalOnProperty(prefix = PropertiesConstants.LICENSE_GENERATE, name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
@ConditionalOnProperty(prefix = PropertiesConstants.LICENSE_GENERATOR, name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
public class LicenseGenerateAutoConfiguration {
private static final Logger log = LoggerFactory.getLogger(LicenseGenerateAutoConfiguration.class);
@@ -52,6 +52,6 @@ public class LicenseGenerateAutoConfiguration {
@PostConstruct
public void postConstruct() {
log.debug("[ContiNew Starter] - Auto Configuration 'License-Generate' completed initialization.");
log.debug("[ContiNew Starter] - Auto Configuration 'License-Generator' completed initialization.");
}
}

View File

@@ -25,8 +25,9 @@ import top.continew.starter.core.constant.PropertiesConstants;
* @author Jasmine
* @since 2.11.0
*/
@ConfigurationProperties(PropertiesConstants.LICENSE_GENERATE)
@ConfigurationProperties(PropertiesConstants.LICENSE_GENERATOR)
public class LicenseGenerateProperties {
/**
* 是否启用
*/

View File

@@ -43,8 +43,7 @@ import java.util.prefs.Preferences;
*
* @author loach
* @since 2.11.0
**/
*/
public class LicenseCreateService {
private static final Logger log = LoggerFactory.getLogger(LicenseCreateService.class);
@@ -88,7 +87,6 @@ public class LicenseCreateService {
* @throws Exception 例外
*/
public void generateLicense(LicenseCreatorParamVO paramVO) throws Exception {
BuildCreatorResp buildCreatorResp = buildCreator(paramVO);
LicenseCreatorParam param = buildCreatorResp.getParam();
ZipFile clientZipFile = buildCreatorResp.getClientZipFile();
@@ -186,7 +184,6 @@ public class LicenseCreateService {
private ZipFile generateClientConfig(LicenseCreatorParam param,
String currentCustomerDir,
String publicAlias) throws Exception {
ZipFile clientLicense = new ZipFile(currentCustomerDir + "clientLicense.zip");
File config = new File(currentCustomerDir + "clientConfig.json");
ConfigParam configParam = new ConfigParam();
@@ -254,7 +251,6 @@ public class LicenseCreateService {
* @return {@link String }
*/
private String relativePath(LicenseCreatorParamVO paramVO) {
if (paramVO.getLicenseSavePath() != null) {
return paramVO.getLicenseSavePath();
}
@@ -284,7 +280,6 @@ public class LicenseCreateService {
* @return {@link LicenseContent }
*/
private LicenseContent initLicenseContent(LicenseCreatorParam param) {
LicenseContent licenseContent = new LicenseContent();
licenseContent.setHolder(DEFAULT_HOLDER_ISSUER);
licenseContent.setIssuer(DEFAULT_HOLDER_ISSUER);

View File

@@ -9,12 +9,11 @@
<version>${revision}</version>
</parent>
<artifactId>continew-starter-license-generate</artifactId>
<packaging>jar</packaging>
<description>ContiNew Starter License生成模块</description>
<artifactId>continew-starter-license-verifier</artifactId>
<description>ContiNew Starter License 模块 - 校验器</description>
<dependencies>
<!-- license 核心模块 -->
<!-- License 模块 - 核心模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-license-core</artifactId>

View File

@@ -26,7 +26,7 @@ import org.springframework.context.annotation.DependsOn;
import de.schlichtherle.license.LicenseManager;
import jakarta.annotation.PostConstruct;
import top.continew.license.Initializing.LicenseStarterInitializingBean;
import top.continew.license.initializing.LicenseStarterInitializingBean;
import top.continew.license.bean.LicenseInstallerBean;
import top.continew.license.manager.CustomLicenseManager;
import top.continew.starter.core.constant.PropertiesConstants;
@@ -39,7 +39,7 @@ import top.continew.starter.core.constant.PropertiesConstants;
*/
@AutoConfiguration
@EnableConfigurationProperties(LicenseVerifyProperties.class)
@ConditionalOnProperty(prefix = PropertiesConstants.LICENSE_VERIFY, name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
@ConditionalOnProperty(prefix = PropertiesConstants.LICENSE_VERIFIER, name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
public class LicenseVerifyAutoConfiguration {
private static final Logger log = LoggerFactory.getLogger(LicenseVerifyAutoConfiguration.class);
@@ -80,7 +80,7 @@ public class LicenseVerifyAutoConfiguration {
@PostConstruct
public void postConstruct() {
log.debug("[ContiNew Starter] - Auto Configuration 'License-Verify' completed initialization.");
log.debug("[ContiNew Starter] - Auto Configuration 'License-Verifier' completed initialization.");
}
}

View File

@@ -26,8 +26,8 @@ import top.continew.starter.core.constant.PropertiesConstants;
*
* @author loach
* @since 2.11.0
**/
@ConfigurationProperties(PropertiesConstants.LICENSE_VERIFY)
*/
@ConfigurationProperties(PropertiesConstants.LICENSE_VERIFIER)
public class LicenseVerifyProperties {
/**

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.license.Initializing;
package top.continew.license.initializing;
import org.springframework.beans.factory.InitializingBean;
import top.continew.license.bean.LicenseInstallerBean;

View File

@@ -1,22 +0,0 @@
## continew-starter-license-verify 食用方法
1. 引入依赖
```java
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-license-verify</artifactId>
<version>2.11.0-SNAPSHOT</version>
</dependency>
```
2. 配置YMLlicense 压缩包存放位置)
```yaml
continew-starter:
license:
verify:
storePath: D:/license
```
注:默认加载 `FileUtil.getTmpDirPath()` 位置。

View File

@@ -12,9 +12,10 @@
<artifactId>continew-starter-license</artifactId>
<packaging>pom</packaging>
<description>ContiNew Starter License模块</description>
<modules>
<module>continew-starter-license-core</module>
<module>continew-starter-license-generate</module>
<module>continew-starter-license-verify</module>
<module>continew-starter-license-generator</module>
<module>continew-starter-license-verifier</module>
</modules>
</project>

View File

@@ -21,7 +21,7 @@ package top.continew.starter.storage.model.req;
*
* @author echo
* @date 2024/11/04 15:13
**/
*/
public class StorageProperties {
/**

View File

@@ -32,7 +32,7 @@
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<!-- Graceful Response一个Spring Boot技术栈下的优雅响应处理组件可以帮助开发者完成响应数据封装、异常处理、错误码填充等过程提高开发效率提高代码质量 -->
<!-- Graceful ResponseSpring Boot技术栈下的优雅响应处理组件可以帮助开发者完成响应数据封装、异常处理、错误码填充等过程提高开发效率提高代码质量 -->
<dependency>
<groupId>com.feiniaojin</groupId>
<artifactId>graceful-response</artifactId>

14
pom.xml
View File

@@ -38,20 +38,20 @@
<module>continew-starter-json</module>
<module>continew-starter-api-doc</module>
<module>continew-starter-web</module>
<module>continew-starter-auth</module>
<module>continew-starter-data</module>
<module>continew-starter-cache</module>
<module>continew-starter-security</module>
<module>continew-starter-ratelimiter</module>
<module>continew-starter-idempotent</module>
<module>continew-starter-trace</module>
<module>continew-starter-log</module>
<module>continew-starter-storage</module>
<module>continew-starter-file</module>
<module>continew-starter-captcha</module>
<module>continew-starter-cache</module>
<module>continew-starter-data</module>
<module>continew-starter-auth</module>
<module>continew-starter-messaging</module>
<module>continew-starter-extension</module>
<module>continew-starter-log</module>
<module>continew-starter-file</module>
<module>continew-starter-storage</module>
<module>continew-starter-license</module>
<module>continew-starter-extension</module>
</modules>
<build>