License(证书认证)

master
parent 9e1f79efc0
commit dc4851acd5

@ -1,4 +1,4 @@
package cn.zifangsky;
package cn;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;

@ -1,4 +1,4 @@
package cn.zifangsky.common;
package cn.common;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;

@ -1,4 +1,4 @@
package cn.zifangsky.config;
package cn.config;
import org.apache.http.Header;
import org.apache.http.client.HttpClient;

@ -1,6 +1,6 @@
package cn.zifangsky.config;
package cn.config;
import cn.zifangsky.license.LicenseCheckInterceptor;
import cn.license.LicenseCheckInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;

@ -1,4 +1,4 @@
package cn.zifangsky.controller;
package cn.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;

@ -1,4 +1,4 @@
package cn.zifangsky.license;
package cn.license;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@ -1,4 +1,4 @@
package cn.zifangsky.license;
package cn.license;
import de.schlichtherle.license.AbstractKeyStoreParam;

@ -1,4 +1,4 @@
package cn.zifangsky.license;
package cn.license;
import de.schlichtherle.license.LicenseContent;
import de.schlichtherle.license.LicenseContentException;
@ -159,10 +159,11 @@ public class CustomLicenseManager extends LicenseManager{
LicenseCheckModel serverCheckModel = getServerInfos();
if(expectedCheckModel != null && serverCheckModel != null){
//校验IP地址
if(!checkIpAddress(expectedCheckModel.getIpAddress(),serverCheckModel.getIpAddress())){
throw new LicenseContentException("当前服务器的IP没在授权范围内");
}
//项目中不需要校验ip所以注释掉
// //校验IP地址
// if(!checkIpAddress(expectedCheckModel.getIpAddress(),serverCheckModel.getIpAddress())){
// throw new LicenseContentException("当前服务器的IP没在授权范围内");
// }
//校验Mac地址
if(!checkIpAddress(expectedCheckModel.getMacAddress(),serverCheckModel.getMacAddress())){

@ -1,4 +1,4 @@
package cn.zifangsky.license;
package cn.license;
import com.alibaba.fastjson.JSON;
import org.apache.logging.log4j.LogManager;

@ -1,4 +1,4 @@
package cn.zifangsky.license;
package cn.license;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;

@ -1,4 +1,4 @@
package cn.zifangsky.license;
package cn.license;
import java.io.Serializable;
import java.util.List;

@ -1,4 +1,4 @@
package cn.zifangsky.license;
package cn.license;
import de.schlichtherle.license.LicenseManager;
import de.schlichtherle.license.LicenseParam;

@ -1,4 +1,4 @@
package cn.zifangsky.license;
package cn.license;
import de.schlichtherle.license.*;
import org.apache.logging.log4j.LogManager;

@ -1,4 +1,4 @@
package cn.zifangsky.license;
package cn.license;
/**
* License

@ -1,4 +1,4 @@
package cn.zifangsky.license;
package cn.license;
import org.apache.commons.lang3.StringUtils;

@ -1,4 +1,4 @@
package cn.zifangsky.license;
package cn.license;
import java.net.InetAddress;
import java.util.List;

@ -2,5 +2,5 @@
license.subject=license_demo
license.publicAlias=publicCert
license.storePass=public_password1234
license.licensePath=C:/Users/zifangsky/Desktop/license_demo/license.lic
license.publicKeysStorePath=C:/Users/zifangsky/Desktop/license_demo/publicCerts.keystore
license.licensePath=D:/license.lic
license.publicKeysStorePath=D:/publicCerts.keystore

@ -1,4 +1,4 @@
package cn.zifangsky;
package cn;
import org.junit.Test;
import org.junit.runner.RunWith;

@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

@ -1,4 +1,4 @@
package cn.zifangsky;
package cn.iocoder.yudao.server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@ -1,4 +1,4 @@
package cn.zifangsky.common;
package cn.iocoder.yudao.server.common;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;

@ -1,4 +1,4 @@
package cn.zifangsky.config;
package cn.iocoder.yudao.server.config;
import org.apache.http.Header;
import org.apache.http.client.HttpClient;

@ -1,4 +1,4 @@
package cn.zifangsky.config;
package cn.iocoder.yudao.server.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;

@ -1,11 +1,6 @@
package cn.zifangsky.controller;
package cn.iocoder.yudao.server.controller;
import cn.zifangsky.license.LicenseCreator;
import cn.zifangsky.license.LinuxServerInfos;
import cn.zifangsky.license.AbstractServerInfos;
import cn.zifangsky.license.LicenseCheckModel;
import cn.zifangsky.license.LicenseCreatorParam;
import cn.zifangsky.license.WindowsServerInfos;
import cn.iocoder.yudao.server.license.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;

@ -1,4 +1,4 @@
package cn.zifangsky.license;
package cn.iocoder.yudao.server.license;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@ -1,12 +1,8 @@
package cn.zifangsky.license;
package cn.iocoder.yudao.server.license;
import de.schlichtherle.license.AbstractKeyStoreParam;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.*;
/**
* KeyStoreParam

@ -1,11 +1,6 @@
package cn.zifangsky.license;
import de.schlichtherle.license.LicenseContent;
import de.schlichtherle.license.LicenseContentException;
import de.schlichtherle.license.LicenseManager;
import de.schlichtherle.license.LicenseNotary;
import de.schlichtherle.license.LicenseParam;
import de.schlichtherle.license.NoLicenseInstalledException;
package cn.iocoder.yudao.server.license;
import de.schlichtherle.license.*;
import de.schlichtherle.xml.GenericCertificate;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;

@ -1,4 +1,4 @@
package cn.zifangsky.license;
package cn.iocoder.yudao.server.license;
import java.io.Serializable;
import java.util.List;

@ -1,12 +1,6 @@
package cn.zifangsky.license;
import de.schlichtherle.license.CipherParam;
import de.schlichtherle.license.DefaultCipherParam;
import de.schlichtherle.license.DefaultLicenseParam;
import de.schlichtherle.license.KeyStoreParam;
import de.schlichtherle.license.LicenseContent;
import de.schlichtherle.license.LicenseManager;
import de.schlichtherle.license.LicenseParam;
package cn.iocoder.yudao.server.license;
import de.schlichtherle.license.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@ -1,4 +1,4 @@
package cn.zifangsky.license;
package cn.iocoder.yudao.server.license;
import com.fasterxml.jackson.annotation.JsonFormat;

@ -1,4 +1,4 @@
package cn.zifangsky.license;
package cn.iocoder.yudao.server.license;
import org.apache.commons.lang3.StringUtils;

@ -1,4 +1,4 @@
package cn.zifangsky.license;
package cn.iocoder.yudao.server.license;
import java.net.InetAddress;
import java.util.List;

@ -1,2 +1,2 @@
#License相关配置
license.licensePath=C:/Users/zifangsky/Desktop/license_demo/license.lic
license.licensePath=D:/license.lic

@ -1,4 +1,4 @@
package cn.zifangsky;
package cn;
import org.junit.Test;
import org.junit.runner.RunWith;
Loading…
Cancel
Save