# 说明 license授权包含2部分内容: 1. 授权校验只针对gmetry-system模块的登录接口做校验(拦截器方式); ` platomix-gmetry-framework模块中:org.springblade.core.config.SecureConfiguration#licenseInterceptor()` 2. 校验内容包含如下几部分内容: * 开发环境和未开启license授权不校验,开启方式(默认开启状态):` blade.license.enabled=true ` * 会校验服务器的CPU序列号和主板序列号,以及过期时间【序列号获取方式见下面】,校验代码如下: ` platomix-gmetry-framework模块中:org.springblade.core.license.LicenseManager#validateOfLogin()` * 一定保证有License授权文件存在,路径配置方式:` blade.license.filePath `,默认文件:/data/docker/webapp/license; * 授权文件的内容是通过RSA加密<2个序列号和过期时间>得到的字符串。LicenseManager的main方法打开注释,填写获取到的2个序列号和过期时间,其他无效的字段可以注释掉,执行main方法得到加密后的字符串,写入到授权文件中,加密代码如下: `platomix-gmetry-framework模块中:org.springblade.core.license.LicenseManager#main()` ### 1.客户获取服务器信息(CPU和主板序列号) Linux环境执行命令: ``` //cpu序列号 dmidecode -t processor | grep 'ID' | awk -F ':' '{print $2}' | head -n 1 //主板序列号 dmidecode | grep 'Serial Number' | awk -F ':' '{print $2}' | head -n 1 ``` Windows环境执行命令: ``` //cpu序列号 wmic cpu get processorid //主板序列号 wmic baseboard get serialnumber ``` Mac环境执行命令: ``` //cpu序列号 system_profiler SPHardwareDataType | fgrep 'UUID' | awk '{print $NF}' //主板序列号 system_profiler SPHardwareDataType | fgrep 'Serial' | awk '{print $NF}' ``` linux环境执行命令: `license/get_server_info.sh`,可以获取到CPU和主板序列号。 ### 2.授权文件说明 1. 加密方式 通过RSA加密【<主板序列号,CPU序列号,过期时间>生成的json字符串】,生成一个加密串;最后把加密字符串写入到授权文件中。 `platomix-gmetry-framework模块中:org.springblade.core.license.LicenseManager#main()` 2. 配置方式 配置仅对gmetry-system项目模块有效。 把授权文件挂载到gmetry-system服务模块的容器下,然后添加如下配置,重启项目后查看log日志打印"结束校验Lincese"表示成功。 ``` blade.license.filePath=/dockerWebappDir/lincese #如果禁用license校验,可以通过配置关闭。【默认开启状态】 blade.license.enabled=false ```