1 Star 0 Fork 210

yepingping / LicenseDemo

forked from zifangsky / LicenseDemo 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 2.12 KB
一键复制 编辑 原始数据 按行查看 历史
zifangsky 提交于 2018-07-10 16:40 . 更新README

LicenseDemo

项目介绍

在基于Spring的项目中使用 TrueLicense 生成和验证License证书(服务器许可)的示例代码

技术依赖:

  • Spring Boot:项目基础架构
  • TrueLicense :基于Java实现的生成和验证服务器许可的简单框架

环境依赖:

  • JDK8+

两个子项目说明:

  • ServerDemo:用于开发者给客户生成License证书的示例代码
  • ClientDemo模拟需要给客户部署的业务项目

ServerDemo项目:

对外发布了两个RESTful接口:

(1)获取服务器硬件信息 :

请求地址:http://127.0.0.1:7000/license/getServerInfos

获取服务器硬件信息

(2)生成证书 :

请求地址:http://127.0.0.1:7000/license/generateLicense

请求时需要在Header中添加一个 Content-Type ,其值为:application/json;charset=UTF-8。请求参数如下:

{
	"subject": "license_demo",
	"privateAlias": "privateKey",
	"keyPass": "private_password1234",
	"storePass": "public_password1234",
	"licensePath": "C:/Users/zifangsky/Desktop/license_demo/license.lic",
	"privateKeysStorePath": "C:/Users/zifangsky/Desktop/license_demo/privateKeys.keystore",
	"issuedTime": "2018-07-10 00:00:01",
	"expiryTime": "2019-12-31 23:59:59",
	"consumerType": "User",
	"consumerAmount": 1,
	"description": "这是证书描述信息",
	"licenseCheckModel": {
		"ipAddress": ["192.168.245.1", "10.0.5.22"],
		"macAddress": ["00-50-56-C0-00-01", "50-7B-9D-F9-18-41"],
		"cpuSerial": "BFEBFBFF000406E3",
		"mainBoardSerial": "L1HF65E00X9"
	}
}

生成证书

ClientDemo项目:

项目启动时安装证书,通过cn/zifangsky/license/LicenseCheckListener.java类实现。用户登录时校验证书的可用性,通过cn/zifangsky/license/LicenseCheckInterceptor.java类实现。

特别说明:

详细开发思路可以参考我写的这篇文章:https://www.zifangsky.cn/1277.html

Java
1
https://gitee.com/yepp3021/LicenseDemo.git
git@gitee.com:yepp3021/LicenseDemo.git
yepp3021
LicenseDemo
LicenseDemo
master

搜索帮助