From f0801de8181d45b497729d6b79d736cb4c823333 Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Fri, 13 Mar 2020 15:15:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BE=9D=E8=B5=96=E5=85=B3?= =?UTF-8?q?=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cloud-common-plugin-dictionary/pom.xml | 12 - cloud-common-plugin-dynamic/pom.xml | 6 +- cloud-common-plugin/pom.xml | 12 - .../cm/common/wechat/filter/WechatFilter.java | 5 + cloud-common/pom.xml | 243 ++++++- .../java/com/cm/common/filter/AppFilter.java | 5 + cloud-security/pom.xml | 8 + .../main/java/com/cm/security/License.java | 12 +- .../src/test/java/com/cm/LicenseTest.java | 2 +- cloud-token-out/pom.xml | 8 + .../main/java/com/cm/token/TokenEncoder.java | 2 +- .../src/test/java/com/cm/EncodeTest.java | 4 +- pom.xml | 594 +++++++++--------- 13 files changed, 580 insertions(+), 333 deletions(-) diff --git a/cloud-common-plugin-dictionary/pom.xml b/cloud-common-plugin-dictionary/pom.xml index 4d93c9b..e73289f 100644 --- a/cloud-common-plugin-dictionary/pom.xml +++ b/cloud-common-plugin-dictionary/pom.xml @@ -18,18 +18,6 @@ com.cm cloud-common 1.0.1-SNAPSHOT - - - org.springframework.security.oauth.boot - spring-security-oauth2-autoconfigure - - - - - - org.springframework.security.oauth.boot - spring-security-oauth2-autoconfigure - ${spring-boot.oauth.autoconfigure.version} diff --git a/cloud-common-plugin-dynamic/pom.xml b/cloud-common-plugin-dynamic/pom.xml index 01b5abd..22108ae 100644 --- a/cloud-common-plugin-dynamic/pom.xml +++ b/cloud-common-plugin-dynamic/pom.xml @@ -36,12 +36,8 @@ com.cm cloud-common-plugin-dictionary 1.0.1-SNAPSHOT + - - org.springframework.security.oauth.boot - spring-security-oauth2-autoconfigure - ${spring-boot.oauth.autoconfigure.version} - \ No newline at end of file diff --git a/cloud-common-plugin/pom.xml b/cloud-common-plugin/pom.xml index 5a305d6..0000ee1 100644 --- a/cloud-common-plugin/pom.xml +++ b/cloud-common-plugin/pom.xml @@ -17,18 +17,6 @@ com.cm cloud-common 1.0.1-SNAPSHOT - - - org.springframework.security.oauth.boot - spring-security-oauth2-autoconfigure - - - - - - org.springframework.security.oauth.boot - spring-security-oauth2-autoconfigure - ${spring-boot.oauth.autoconfigure.version} diff --git a/cloud-common-wechat/src/main/java/com/cm/common/wechat/filter/WechatFilter.java b/cloud-common-wechat/src/main/java/com/cm/common/wechat/filter/WechatFilter.java index 553f184..30d4a3c 100644 --- a/cloud-common-wechat/src/main/java/com/cm/common/wechat/filter/WechatFilter.java +++ b/cloud-common-wechat/src/main/java/com/cm/common/wechat/filter/WechatFilter.java @@ -110,6 +110,11 @@ public class WechatFilter implements Filter { errorResponse(response, "token不能为空"); } + @Override + public void destroy() { + + } + private void tokenFilter(String token, HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException { try { checkToken(token); diff --git a/cloud-common/pom.xml b/cloud-common/pom.xml index 5e139f9..76d2545 100644 --- a/cloud-common/pom.xml +++ b/cloud-common/pom.xml @@ -13,31 +13,256 @@ 1.0.1-SNAPSHOT + + + redis.clients + jedis + + + + + org.springframework + spring-context + + + org.springframework + spring-beans + + + org.springframework + spring-web + + + org.springframework + spring-webmvc + + + org.springframework + spring-jdbc + + + org.springframework + spring-aspects + + + org.springframework + spring-context-support + + + + + + com.alibaba + fastjson + + + + + + com.alibaba + easyexcel + + + + + + mysql + mysql-connector-java + + + + + + com.alibaba + druid + + + + + + com.github.pagehelper + pagehelper + + + + + org.apache.httpcomponents + httpclient + + + + org.apache.httpcomponents + httpmime + + + + + org.apache.shiro + shiro-core + + + org.apache.shiro + shiro-web + + + org.apache.shiro + shiro-spring + + + org.apache.shiro + shiro-ehcache + + + org.apache.shiro + shiro-all + + + org.apache.shiro + shiro-quartz + + + + + + + javax.validation + validation-api + + + org.hibernate + hibernate-validator + + + + + dom4j + dom4j + + + + + org.quartz-scheduler + quartz + + + + + net.sf.ehcache + ehcache + + + + + net.coobird + thumbnailator + + + + + javax.servlet + javax.servlet-api + + + javax.servlet + jsp-api + + + jstl + jstl + + + + + joda-time + joda-time + + + + + org.apache.commons + commons-lang3 + + + org.apache.commons + commons-text + + + commons-io + commons-io + + + commons-net + commons-net + + + commons-fileupload + commons-fileupload + + + commons-codec + commons-codec + + + org.apache.commons + commons-compress + + + commons-beanutils + commons-beanutils + + + + + org.apache.poi + poi + + + + + com.sun.xml.messaging.saaj + saaj-impl + + + + + io.springfox + springfox-swagger2 + + + io.springfox + springfox-swagger-ui + + + + + com.google.zxing + core + + + + + + com.belerweb + pinyin4j + + + org.springframework.boot spring-boot-starter-security - ${spring-boot.version} - org.springframework.boot spring-boot-starter-web - ${spring-boot.version} - org.springframework.security.oauth.boot spring-security-oauth2-autoconfigure - ${spring-boot.oauth.autoconfigure.version} - org.springframework.security spring-security-jwt - 1.0.9.RELEASE - - \ No newline at end of file diff --git a/cloud-common/src/main/java/com/cm/common/filter/AppFilter.java b/cloud-common/src/main/java/com/cm/common/filter/AppFilter.java index 6ccb88f..bdfc197 100644 --- a/cloud-common/src/main/java/com/cm/common/filter/AppFilter.java +++ b/cloud-common/src/main/java/com/cm/common/filter/AppFilter.java @@ -84,6 +84,11 @@ public class AppFilter implements Filter { filterChain.doFilter(request, response); } + @Override + public void destroy() { + + } + /** * 校验token * diff --git a/cloud-security/pom.xml b/cloud-security/pom.xml index 10927ec..7875376 100644 --- a/cloud-security/pom.xml +++ b/cloud-security/pom.xml @@ -24,6 +24,14 @@ java-jwt 3.8.2 + + commons-codec + commons-codec + + + com.alibaba + fastjson + diff --git a/cloud-security/src/main/java/com/cm/security/License.java b/cloud-security/src/main/java/com/cm/security/License.java index 64ba7c8..10e8287 100644 --- a/cloud-security/src/main/java/com/cm/security/License.java +++ b/cloud-security/src/main/java/com/cm/security/License.java @@ -105,14 +105,16 @@ public class License { } // mac,mac不匹配 List macIds = AddressUtil.getMacIds(); + boolean confirmMac = false; for (String macId : macIds) { - if (!checkInfo[1].equals(macId)) { - return false; - } - if (!mac.equals(DigestUtils.md5Hex(checkInfo[1]))) { - return false; + if (checkInfo[1].equals(macId) && mac.equals(DigestUtils.md5Hex(checkInfo[1]))) { + confirmMac = true; + break; } } + if (!confirmMac) { + return false; + } // 授权时长 if (!time.equals(DigestUtils.md5Hex(checkInfo[2]))) { return false; diff --git a/cloud-security/src/test/java/com/cm/LicenseTest.java b/cloud-security/src/test/java/com/cm/LicenseTest.java index 0ee1ade..80eb313 100644 --- a/cloud-security/src/test/java/com/cm/LicenseTest.java +++ b/cloud-security/src/test/java/com/cm/LicenseTest.java @@ -27,7 +27,7 @@ public class LicenseTest { // String mac = AddressUtil.getMacAddress(); // System.out.println(mac); - String license = License.getLicense("2020-02-18", "1000", "00-16-3E-00-62-F6", "_System_License_"); + String license = License.getLicense("2020-02-18", "1000", "08-ED-B9-00-10-6D", "_System_License_"); System.out.println(license); } diff --git a/cloud-token-out/pom.xml b/cloud-token-out/pom.xml index 3e8ec64..3ecbfa7 100644 --- a/cloud-token-out/pom.xml +++ b/cloud-token-out/pom.xml @@ -20,6 +20,14 @@ 4.12 test + + org.apache.commons + commons-lang3 + + + commons-codec + commons-codec + diff --git a/cloud-token-out/src/main/java/com/cm/token/TokenEncoder.java b/cloud-token-out/src/main/java/com/cm/token/TokenEncoder.java index 9b7f2e3..8491022 100644 --- a/cloud-token-out/src/main/java/com/cm/token/TokenEncoder.java +++ b/cloud-token-out/src/main/java/com/cm/token/TokenEncoder.java @@ -2,7 +2,7 @@ package com.cm.token; import com.cm.AesUtil; import org.apache.commons.codec.binary.Base64; -import org.springframework.util.StringUtils; +import org.apache.commons.lang3.StringUtils; /** * @author Administrator diff --git a/cloud-token-out/src/test/java/com/cm/EncodeTest.java b/cloud-token-out/src/test/java/com/cm/EncodeTest.java index b9ccecf..48b5455 100644 --- a/cloud-token-out/src/test/java/com/cm/EncodeTest.java +++ b/cloud-token-out/src/test/java/com/cm/EncodeTest.java @@ -1,7 +1,7 @@ package com.cm; import com.cm.token.TokenEncoder; -import com.hazelcast.util.Base64; +import org.apache.commons.codec.binary.Base64; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; @@ -37,7 +37,7 @@ public class EncodeTest { SecretKey secretKey = kgen.generateKey(); byte[] enCodeFormat = secretKey.getEncoded();//AES加密实际的Key值 - System.out.println(new String(Base64.encode(enCodeFormat))); + System.out.println(new String(Base64.encodeBase64String(enCodeFormat))); } diff --git a/pom.xml b/pom.xml index 408f4c4..a08c989 100644 --- a/pom.xml +++ b/pom.xml @@ -63,287 +63,285 @@ 2.5.1 - - - redis.clients - jedis - ${jedis.version} - - - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-beans - ${spring.version} - - - org.springframework - spring-web - ${spring.version} - - - org.springframework - spring-webmvc - ${spring.version} - - - org.springframework - spring-jdbc - ${spring.version} - - - org.springframework - spring-aspects - ${spring.version} - - - org.springframework - spring-context-support - ${spring.version} - - - - - - com.alibaba - fastjson - ${fastjson.version} - - - - - - com.alibaba - easyexcel - ${easyexcel.version} - - - - - - mysql - mysql-connector-java - ${mysql.version} - - - - - - com.alibaba - druid - ${durid.version} - - - - - - com.github.pagehelper - pagehelper - ${pagehelper.version} - - - - - org.apache.httpcomponents - httpclient - ${httpclient.version} - - - - org.apache.httpcomponents - httpmime - ${httpclient.version} - - - - - org.apache.shiro - shiro-core - ${shiro.version} - - - org.apache.shiro - shiro-web - ${shiro.version} - - - org.apache.shiro - shiro-spring - ${shiro.version} - - - org.apache.shiro - shiro-ehcache - ${shiro.version} - - - org.apache.shiro - shiro-all - ${shiro.version} - - - org.apache.shiro - shiro-quartz - - - - - - - javax.validation - validation-api - ${validation.version} - - - org.hibernate - hibernate-validator - ${hibernate-validation.version} - - - - - dom4j - dom4j - ${dom4j.version} - - - - - org.quartz-scheduler - quartz - ${quartz.version} - - - - - net.sf.ehcache - ehcache - ${ehcache.version} - - - - - net.coobird - thumbnailator - ${thumbnailator.version} - - - - - javax.servlet - javax.servlet-api - ${servletApi.version} - - - javax.servlet - jsp-api - ${jspApi.version} - - - jstl - jstl - ${jstl.version} - - - - - joda-time - joda-time - ${jodaTime.version} - - - - - org.apache.commons - commons-lang3 - ${commonLang3.version} - - - org.apache.commons - commons-text - ${commons-text.version} - - - commons-io - commons-io - ${common-io.version} - - - commons-net - commons-net - ${common-net.version} - - - commons-fileupload - commons-fileupload - ${common-fileupload.version} - - - commons-codec - commons-codec - ${common-codec.version} - - - org.apache.commons - commons-compress - ${common-compress} - - - commons-beanutils - commons-beanutils - ${common-beanutils.version} - - - - - org.apache.poi - poi - ${poi.version} - - - - - com.sun.xml.messaging.saaj - saaj-impl - ${saaj.version} - - - - - io.springfox - springfox-swagger2 - ${swagger.version} - - - io.springfox - springfox-swagger-ui - ${swagger.version} - - - - - com.google.zxing - core - ${zxing.version} - - - - - - com.belerweb - pinyin4j - ${pingyin4j.version} - - - - + + + redis.clients + jedis + ${jedis.version} + + + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-web + ${spring.version} + + + org.springframework + spring-webmvc + ${spring.version} + + + org.springframework + spring-jdbc + ${spring.version} + + + org.springframework + spring-aspects + ${spring.version} + + + org.springframework + spring-context-support + ${spring.version} + + + + + + com.alibaba + fastjson + ${fastjson.version} + + + + + + com.alibaba + easyexcel + ${easyexcel.version} + + + + + + mysql + mysql-connector-java + ${mysql.version} + + + + + + com.alibaba + druid + ${durid.version} + + + + + + com.github.pagehelper + pagehelper + ${pagehelper.version} + + + + + org.apache.httpcomponents + httpclient + ${httpclient.version} + + + + org.apache.httpcomponents + httpmime + ${httpclient.version} + + + + + org.apache.shiro + shiro-core + ${shiro.version} + + + org.apache.shiro + shiro-web + ${shiro.version} + + + org.apache.shiro + shiro-spring + ${shiro.version} + + + org.apache.shiro + shiro-ehcache + ${shiro.version} + + + org.apache.shiro + shiro-all + ${shiro.version} + + + org.apache.shiro + shiro-quartz + + + + + + + javax.validation + validation-api + ${validation.version} + + + org.hibernate + hibernate-validator + ${hibernate-validation.version} + + + + + dom4j + dom4j + ${dom4j.version} + + + + + org.quartz-scheduler + quartz + ${quartz.version} + + + + + net.sf.ehcache + ehcache + ${ehcache.version} + + + + + net.coobird + thumbnailator + ${thumbnailator.version} + + + + + javax.servlet + javax.servlet-api + ${servletApi.version} + + + javax.servlet + jsp-api + ${jspApi.version} + + + jstl + jstl + ${jstl.version} + + + + + joda-time + joda-time + ${jodaTime.version} + + + + + org.apache.commons + commons-lang3 + ${commonLang3.version} + + + org.apache.commons + commons-text + ${commons-text.version} + + + commons-io + commons-io + ${common-io.version} + + + commons-net + commons-net + ${common-net.version} + + + commons-fileupload + commons-fileupload + ${common-fileupload.version} + + + commons-codec + commons-codec + ${common-codec.version} + + + org.apache.commons + commons-compress + ${common-compress} + + + commons-beanutils + commons-beanutils + ${common-beanutils.version} + + + + + org.apache.poi + poi + ${poi.version} + + + + + com.sun.xml.messaging.saaj + saaj-impl + ${saaj.version} + + + + + io.springfox + springfox-swagger2 + ${swagger.version} + + + io.springfox + springfox-swagger-ui + ${swagger.version} + + + + + com.google.zxing + core + ${zxing.version} + + + + + + com.belerweb + pinyin4j + ${pingyin4j.version} + + org.springframework.cloud spring-cloud-dependencies @@ -351,6 +349,30 @@ pom import + + + org.springframework.boot + spring-boot-starter-security + ${spring-boot.version} + + + + org.springframework.boot + spring-boot-starter-web + ${spring-boot.version} + + + + org.springframework.security.oauth.boot + spring-security-oauth2-autoconfigure + ${spring-boot.oauth.autoconfigure.version} + + + + org.springframework.security + spring-security-jwt + 1.0.9.RELEASE + @@ -366,13 +388,13 @@ - - - spring-milestones - Spring Milestones - https://mvnrepository.com - - + + + spring-milestones + Spring Milestones + https://mvnrepository.com + + ${project.artifactId}