smartboot 开源组织 smartboot 开源组织
首页
  • smart-socket
  • smart-http
  • smart-servlet
  • smart-mqtt
  • smart-license
  • feat
❤️开源捐赠
💰付费服务
🏠加入社区
  • Gitee (opens new window)
  • Github (opens new window)
首页
  • smart-socket
  • smart-http
  • smart-servlet
  • smart-mqtt
  • smart-license
  • feat
❤️开源捐赠
💰付费服务
🏠加入社区
  • Gitee (opens new window)
  • Github (opens new window)
  • 关于 smart-license
  • 指南

    • 快手上手
      • 一、云端申请 License
      • 二、软件集成 License
        • 2.1 引入Maven依赖
        • 2.2 载入License
  • smart-license
  • 指南
三刀
2022-11-16
目录

快手上手

# 一、云端申请 License

  1. 登录 Shield.盾 (opens new window)
  2. 完成表单登记,上传License源文件
  3. 服务生成 License 后会自动触发浏览器下载:License.shield文件。

# 二、软件集成 License

# 2.1 引入Maven依赖

在你的工程中引入 smart-license 客户端依赖。

<dependency>
    <groupId>org.smartboot.license</groupId>
    <artifactId>license-client</artifactId>
    <version>2.0</version>
</dependency>
1
2
3
4
5

# 2.2 载入License

如若License已过期,则会触发过期回调。

private void loadLicense(Properties properties) {
    1️⃣ License license = new License(entity -> EnterprisePlugin.this.uninstall(),10);

    2️⃣ try (InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("License.shield")) {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        byte[] bytes = new byte[1024];
        int size;
        while ((size = inputStream.read(bytes)) > 0) {
        byteArrayOutputStream.write(bytes, 0, size);
        }
    3️⃣  LicenseEntity entity = license.loadLicense(byteArrayOutputStream.toByteArray());
    4️⃣  properties.load(new ByteArrayInputStream(entity.getData()));
        System.out.println(properties);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  1. 初始化 License 客户端。注册license过期后的回调逻辑,以及过期状态下的回调重复触发频率(单位:秒)。
  2. 加载 License 文件流。
  3. 解析 License 进行合法性校验,并获取授权内容。
  4. 基于授权内容进行软件运行时配置初始化。
关于 smart-license

← 关于 smart-license

Theme by Vdoing | Copyright © 2017-2025 三刀
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式