LicenseVerifyProperties.java
1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.huaheng.spring.boot.autoconfigure;
import cn.hutool.core.lang.Assert;
import com.huaheng.license.core.common.pojo.params.LicenseVerifyParam;
import com.huaheng.license.core.common.utils.KeyStoreUtils;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.ArrayList;
import java.util.List;
/**
* License验证属性
* @author Rong.Jia
* @date 2022/03/10
*/
@Data
@ConfigurationProperties(prefix = "license.verify")
public class LicenseVerifyProperties {
/**
* 主题
*/
private String subject = "软件许可证书";
/**
* 公钥存储路径
*/
private String publicKeysStorePath = "/publicCerts.keystore";
/**
* 私钥库密码
*/
private String password = "";
/**
* 公钥别名
*/
private String publicAlias = KeyStoreUtils.PUBLIC_CERT_ALIAS;
/**
* 许可证文件路径
*/
private String licensePath = "classpath:license.lic";
/**
* 需要跳过验证授权的接口
*/
private List<String> excludePathPatterns = new ArrayList<>();
public LicenseVerifyParam getVerifyParam() {
Assert.notBlank(password, "密码不能为空");
LicenseVerifyParam param = new LicenseVerifyParam();
param.setSubject(subject);
param.setPublicAlias(publicAlias);
param.setStorePass(password);
param.setLicensePath(licensePath);
param.setPublicKeysStorePath(publicKeysStorePath);
return param;
}
}