From c82ccee1b659166d03cc1033c555ada00c587e41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E5=90=89=E6=AC=A2?= Date: Wed, 23 Jan 2019 15:27:03 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=BA=90=E7=A0=81?= =?UTF-8?q?=E6=89=93=E5=8C=85=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- encrypt-core/pom.xml | 27 +++++++++++++++++++++++++++ encrypt-springboot-example/pom.xml | 13 ++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/encrypt-core/pom.xml b/encrypt-core/pom.xml index fc518e2..342de9d 100644 --- a/encrypt-core/pom.xml +++ b/encrypt-core/pom.xml @@ -38,4 +38,31 @@ 1.7.21 + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + maven-source-plugin + 2.1 + + true + + + + compile + + jar + + + + + + diff --git a/encrypt-springboot-example/pom.xml b/encrypt-springboot-example/pom.xml index 9222fe7..bc155d8 100644 --- a/encrypt-springboot-example/pom.xml +++ b/encrypt-springboot-example/pom.xml @@ -41,5 +41,16 @@ spring-boot-starter-freemarker - + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + From 4aa352f8fc18fc05b774443da08c4aab0ee92abd Mon Sep 17 00:00:00 2001 From: yinjihuan Date: Wed, 23 Jan 2019 21:53:57 +0800 Subject: [PATCH 2/6] add --- .../com.cxytiandi/encrypt-core/pom.properties | 7 ---- .../maven/com.cxytiandi/encrypt-core/pom.xml | 41 ------------------- .../encrypt-springboot-example/pom.properties | 2 +- 3 files changed, 1 insertion(+), 49 deletions(-) delete mode 100644 encrypt-core/target/classes/META-INF/maven/com.cxytiandi/encrypt-core/pom.properties delete mode 100644 encrypt-core/target/classes/META-INF/maven/com.cxytiandi/encrypt-core/pom.xml diff --git a/encrypt-core/target/classes/META-INF/maven/com.cxytiandi/encrypt-core/pom.properties b/encrypt-core/target/classes/META-INF/maven/com.cxytiandi/encrypt-core/pom.properties deleted file mode 100644 index f544aa8..0000000 --- a/encrypt-core/target/classes/META-INF/maven/com.cxytiandi/encrypt-core/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Sat Jan 12 21:49:48 CST 2019 -version=1.1-SNAPSHOT -groupId=com.cxytiandi -m2e.projectName=encrypt-core -m2e.projectLocation=/Users/yinjihuan/Documents/workspace_spring_cloud/jiamin/spring-boot-starter-encrypt/encrypt-core -artifactId=encrypt-core diff --git a/encrypt-core/target/classes/META-INF/maven/com.cxytiandi/encrypt-core/pom.xml b/encrypt-core/target/classes/META-INF/maven/com.cxytiandi/encrypt-core/pom.xml deleted file mode 100644 index aa0e4d2..0000000 --- a/encrypt-core/target/classes/META-INF/maven/com.cxytiandi/encrypt-core/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - 4.0.0 - - com.cxytiandi - encrypt-core - 1.1-SNAPSHOT - jar - - encrypt-core - http://maven.apache.org - - - UTF-8 - - - - - javax.servlet - javax.servlet-api - 3.1.0 - provided - - - commons-codec - commons-codec - 1.10 - - - commons-io - commons-io - 2.6 - - - org.slf4j - slf4j-api - 1.7.21 - - - diff --git a/encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.properties b/encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.properties index 41755ca..ffb244d 100644 --- a/encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.properties +++ b/encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven Integration for Eclipse -#Sat Jan 12 21:50:19 CST 2019 +#Sun Jan 13 13:37:00 CST 2019 version=1.1-SNAPSHOT groupId=com.cxytiandi m2e.projectName=encrypt-springboot-example From 553830f86fb4c60ef3ea11bd496380de0a8ecbb9 Mon Sep 17 00:00:00 2001 From: yinjihuan Date: Wed, 23 Jan 2019 23:03:56 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E9=80=82=E9=85=8Dspring=20boot=E5=90=AF?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- encrypt-core/.project | 5 ++ encrypt-core/pom.xml | 12 +++++ .../encrypt/core/EncryptionConfig.java | 28 ++++++++++ .../springboot/annotation/EnableEncrypt.java | 39 ++++++++++++++ .../EncryptAutoConfiguration.java | 48 ++++++++++++++++++ .../encrypt/core/EncryptionConfig.class | Bin 2334 -> 3035 bytes .../encrypt_springboot_example/App.java | 3 ++ .../config/FilterConfig.java | 7 +-- .../src/main/resources/application.properties | 14 ++++- .../encrypt-springboot-example/pom.properties | 2 +- .../encrypt-springboot-example/pom.xml | 13 ++++- .../target/classes/application.properties | 14 ++++- .../encrypt_springboot_example/App.class | Bin 715 -> 781 bytes .../config/FilterConfig.class | Bin 2025 -> 1669 bytes 14 files changed, 178 insertions(+), 7 deletions(-) create mode 100644 encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/annotation/EnableEncrypt.java create mode 100644 encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/autoconfigure/EncryptAutoConfiguration.java diff --git a/encrypt-core/.project b/encrypt-core/.project index 3cc5b19..6eca057 100644 --- a/encrypt-core/.project +++ b/encrypt-core/.project @@ -15,6 +15,11 @@ + + org.springframework.ide.eclipse.boot.validation.springbootbuilder + + + org.eclipse.jdt.core.javanature diff --git a/encrypt-core/pom.xml b/encrypt-core/pom.xml index 342de9d..e5e5558 100644 --- a/encrypt-core/pom.xml +++ b/encrypt-core/pom.xml @@ -37,6 +37,18 @@ slf4j-api 1.7.21 + + org.springframework + spring-context + 5.0.10.RELEASE + provided + + + org.springframework.boot + spring-boot-autoconfigure + 2.0.6.RELEASE + provided + diff --git a/encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionConfig.java b/encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionConfig.java index ff234c0..45b0431 100644 --- a/encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionConfig.java +++ b/encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionConfig.java @@ -3,6 +3,8 @@ import java.util.ArrayList; import java.util.List; +import org.springframework.boot.context.properties.ConfigurationProperties; + /** * 加解密配置类 * @@ -13,6 +15,7 @@ * @about http://cxytiandi.com/about * */ +@ConfigurationProperties(prefix = "spring.encrypt") public class EncryptionConfig { /** @@ -44,6 +47,16 @@ public class EncryptionConfig { */ private boolean debug = false; + /** + * 过滤器拦截模式 + */ + private String[] urlPatterns = new String[] { "/*" }; + + /** + * 过滤器执行顺序 + */ + private int order = 1; + public EncryptionConfig() { super(); } @@ -98,4 +111,19 @@ public void setDebug(boolean debug) { this.debug = debug; } + public void setUrlPatterns(String[] urlPatterns) { + this.urlPatterns = urlPatterns; + } + + public String[] getUrlPatterns() { + return urlPatterns; + } + + public void setOrder(int order) { + this.order = order; + } + + public int getOrder() { + return order; + } } diff --git a/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/annotation/EnableEncrypt.java b/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/annotation/EnableEncrypt.java new file mode 100644 index 0000000..e91c088 --- /dev/null +++ b/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/annotation/EnableEncrypt.java @@ -0,0 +1,39 @@ +package com.cxytiandi.encrypt.springboot.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import org.springframework.context.annotation.Import; + +import com.cxytiandi.encrypt.springboot.autoconfigure.EncryptAutoConfiguration; + +/** + * 启用加密Starter + * + *

在Spring Boot启动类上加上此注解

+ * + *

+ * @SpringBootApplication
+ * @EnableEncrypt
+ * public class App {
+ *     public static void main(String[] args) {
+ *         SpringApplication.run(App.class, args);
+ *     }
+ * }
+ * 
+ * 
+ * @author yinjihuan
+ *
+ * @about http://cxytiandi.com/about
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@Inherited
+@Import({EncryptAutoConfiguration.class})
+public @interface EnableEncrypt {
+
+}
diff --git a/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/autoconfigure/EncryptAutoConfiguration.java b/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/autoconfigure/EncryptAutoConfiguration.java
new file mode 100644
index 0000000..b11558e
--- /dev/null
+++ b/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/autoconfigure/EncryptAutoConfiguration.java
@@ -0,0 +1,48 @@
+package com.cxytiandi.encrypt.springboot.autoconfigure;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import com.cxytiandi.encrypt.core.EncryptionConfig;
+import com.cxytiandi.encrypt.core.EncryptionFilter;
+
+
+/**
+ * 加解密自动配置
+ * 
+ * @author yinjihuan
+ * 
+ * @about http://cxytiandi.com/about
+ *
+ */
+@Configuration
+@EnableAutoConfiguration
+@EnableConfigurationProperties(EncryptionConfig.class)
+public class EncryptAutoConfiguration {
+
+	@Autowired
+	private EncryptionConfig encryptionConfig;
+	
+	/**
+	 * 不要用泛型注册Filter,泛型在Spring Boot 2.x版本中才有
+	 * @return
+	 */
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	@Bean
+    public FilterRegistrationBean filterRegistration() {
+    	EncryptionConfig config = new EncryptionConfig();
+    	config.setKey(encryptionConfig.getKey());
+    	config.setRequestDecyptUriList(encryptionConfig.getRequestDecyptUriList());
+    	config.setResponseEncryptUriList(encryptionConfig.getResponseEncryptUriList());
+        FilterRegistrationBean registration = new FilterRegistrationBean();
+        registration.setFilter(new EncryptionFilter(config));
+        registration.addUrlPatterns(encryptionConfig.getUrlPatterns());
+        registration.setName("EncryptionFilter");
+        registration.setOrder(encryptionConfig.getOrder());
+        return registration;
+    }
+	
+}
diff --git a/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionConfig.class b/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionConfig.class
index fd1bee91aa6339de63943741dbbe06ac19794e9c..621f5decc762b341ad705bb51ac84f68da83bc70 100644
GIT binary patch
literal 3035
zcmbtVYf~F#6n>Um2@x>dN?WC9fv_}eTT6>TQ@IKf3vw%IKj)>4%UKfvayCTS4VVe~NJ+GRf$=S;mPJ9^=S5}e9eMg3$?w+%jf%CK`}
zP)ahn|Iidvh1GO(3VrpP4L-{@@|xu(C%61=sK8e6!Czz3|?E9S-eb5N1QoY*|y5Ub_`L`+=W`T
zmIA%I$(A-4J^SeN6QL^f&Z=+GucmI)a8vyQxASlDVGTo<;;@?fxP}omRKu7W{uAT*
zP-lvTW{}Lpt
zDT>C8>oK!aB3{h-|HV$7;Hd6#JeeAX)j^^>qV`276eb=56Q7aET6hQXMJ!+mpJN$0
ztYC|zeXPo0vNGv;FBl*%sdH-cvS4je;!<%r^Ss^37fW2G2%eDKPvN`vTvnDkD2X9T
z%``rxCl^ekH={<>-*EF6651sFs8p^ukMYS%UQB!;HXT=Wz}4F8$@GMBDh4N
z^;`LOA{Zzjus^7Gr>dt8+RW2`=b1AUABYuj-K#I%3tw?x#A
zT2SL|WFjln(an7}_Oq|gjsuCTV$HjJ*=M)BA#=ObEvH39$}NcSFffrXu-=44W1R5^
zRUs^=1s3l;#>(MK536x_GXCto2@L8vHkyb~Pz@{34eEO$@YrRzXc0i69}Z*Qf55bRE`f
zgzt$TAYoMki3{LXxCg{LXC2#FuY>w$_nbLrXP$Xy#{T=?KmG!67Z1~j8CbEKugmt&
z9pACsx>HuJ?RC!lvfcDl`HNuVG~NBC`@(6YkuWgz%KFJFpIUCC{B`Y>vV8;bA5_Oc
zzB)KL@;%3G>>4O~s&&?MTdL>lx#v`!7QdMaZnu5sv@90hoj7tDuI0BqW#DG$cyH8s
zg`doL>c_Tf`Hz%M>b~>I^QikTEw7~*E?HN#cEf;iVj#8WxQ<^TcWL?9Kw`gHS6Rd{
zox>!iGANL)zFphde6giA*6&(1yKYUuz-$glq|%r(Fs)P7@Sk~})sYOcxQc1HcP)oB
zGP1g!!xdyQxIuvD&kojh#Q0$jIizHDGlzHZu7Sy_JFHT|rP8g-H%%CtWb`60-@G3~S-1%txb;HYGHsb@%(bPHsUnr+Wk2adF9
zA^Zz*N9F>H?Cm&zW0Hu;#BddpiJ)~tue029E-vgj68ek-!FP^loJBt0RY_;x%dhj^eLe#58tF8!JQVCHv~#fqW#DtMIlsPH8CyH3`CfPKtW59w&
z7WJe_nHts3a%EuaQq+Yo>XS&+?aNUY!l+M)dNc+#n6Y70DX*aJM3#3kjCdT0crUuV
zi{bK~5be7$Xwr=Wa-ZEi+Gk6@P}t!<`#ut651;lv9`xD#h1n0vStE!&21JHIKq@-o
GgZ}`I%d6M`

diff --git a/encrypt-springboot-example/src/main/java/com/cxytiandi/encrypt_springboot_example/App.java b/encrypt-springboot-example/src/main/java/com/cxytiandi/encrypt_springboot_example/App.java
index 302cb75..c0d28aa 100644
--- a/encrypt-springboot-example/src/main/java/com/cxytiandi/encrypt_springboot_example/App.java
+++ b/encrypt-springboot-example/src/main/java/com/cxytiandi/encrypt_springboot_example/App.java
@@ -3,6 +3,9 @@
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 
+import com.cxytiandi.encrypt.springboot.annotation.EnableEncrypt;
+
+@EnableEncrypt
 @SpringBootApplication
 public class App {
 
diff --git a/encrypt-springboot-example/src/main/java/com/cxytiandi/encrypt_springboot_example/config/FilterConfig.java b/encrypt-springboot-example/src/main/java/com/cxytiandi/encrypt_springboot_example/config/FilterConfig.java
index 87325ac..d3ebbb2 100644
--- a/encrypt-springboot-example/src/main/java/com/cxytiandi/encrypt_springboot_example/config/FilterConfig.java
+++ b/encrypt-springboot-example/src/main/java/com/cxytiandi/encrypt_springboot_example/config/FilterConfig.java
@@ -10,16 +10,17 @@
 import com.cxytiandi.encrypt.core.EncryptionFilter;
 import com.cxytiandi.encrypt_springboot_example.algorithm.RsaEncryptAlgorithm;
 
-@Configuration
+//@Configuration
 public class FilterConfig {
 
     @Bean
-    public FilterRegistrationBean filterRegistration() {
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    public FilterRegistrationBean filterRegistration() {
     	EncryptionConfig config = new EncryptionConfig();
     	config.setKey("abcdef0123456789");
     	config.setRequestDecyptUriList(Arrays.asList("/save", "/decryptEntityXml"));
     	config.setResponseEncryptUriList(Arrays.asList("/encryptStr", "/encryptEntity", "/save", "/encryptEntityXml", "/decryptEntityXml"));
-        FilterRegistrationBean registration = new FilterRegistrationBean();
+        FilterRegistrationBean registration = new FilterRegistrationBean();
         registration.setFilter(new EncryptionFilter(config));
         //registration.setFilter(new EncryptionFilter(config, new RsaEncryptAlgorithm()));
         registration.addUrlPatterns("/*");
diff --git a/encrypt-springboot-example/src/main/resources/application.properties b/encrypt-springboot-example/src/main/resources/application.properties
index 8f21ac4..095e4d5 100755
--- a/encrypt-springboot-example/src/main/resources/application.properties
+++ b/encrypt-springboot-example/src/main/resources/application.properties
@@ -7,4 +7,16 @@ spring.freemarker.content-type=text/html
 spring.freemarker.expose-request-attributes=true
 spring.freemarker.expose-session-attributes=true
 spring.freemarker.request-context-attribute=request
-spring.freemarker.suffix=.html
\ No newline at end of file
+spring.freemarker.suffix=.html
+
+spring.encrypt.key=abcdef0123456789
+spring.encrypt.requestDecyptUriList[0]=/save
+spring.encrypt.requestDecyptUriList[1]=/decryptEntityXml
+
+spring.encrypt.responseEncryptUriList[0]=/encryptStr
+spring.encrypt.responseEncryptUriList[1]=/encryptEntity
+spring.encrypt.responseEncryptUriList[2]=/save
+spring.encrypt.responseEncryptUriList[3]=/encryptEntityXml
+spring.encrypt.responseEncryptUriList[4]=/decryptEntityXml
+#spring.encrypt.urlPatterns[0]=/user/*
+#spring.encrypt.urlPatterns[1]=/save/*
\ No newline at end of file
diff --git a/encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.properties b/encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.properties
index ffb244d..34f5ee9 100644
--- a/encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.properties
+++ b/encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.properties
@@ -1,5 +1,5 @@
 #Generated by Maven Integration for Eclipse
-#Sun Jan 13 13:37:00 CST 2019
+#Wed Jan 23 22:52:09 CST 2019
 version=1.1-SNAPSHOT
 groupId=com.cxytiandi
 m2e.projectName=encrypt-springboot-example
diff --git a/encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.xml b/encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.xml
index 9222fe7..bc155d8 100644
--- a/encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.xml
+++ b/encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.xml
@@ -41,5 +41,16 @@
 			spring-boot-starter-freemarker
 		
 	
-
+	
+		
+			
+				org.apache.maven.plugins
+				maven-compiler-plugin
+				
+					1.8
+					1.8
+				
+			
+		
+	
 
diff --git a/encrypt-springboot-example/target/classes/application.properties b/encrypt-springboot-example/target/classes/application.properties
index 8f21ac4..095e4d5 100755
--- a/encrypt-springboot-example/target/classes/application.properties
+++ b/encrypt-springboot-example/target/classes/application.properties
@@ -7,4 +7,16 @@ spring.freemarker.content-type=text/html
 spring.freemarker.expose-request-attributes=true
 spring.freemarker.expose-session-attributes=true
 spring.freemarker.request-context-attribute=request
-spring.freemarker.suffix=.html
\ No newline at end of file
+spring.freemarker.suffix=.html
+
+spring.encrypt.key=abcdef0123456789
+spring.encrypt.requestDecyptUriList[0]=/save
+spring.encrypt.requestDecyptUriList[1]=/decryptEntityXml
+
+spring.encrypt.responseEncryptUriList[0]=/encryptStr
+spring.encrypt.responseEncryptUriList[1]=/encryptEntity
+spring.encrypt.responseEncryptUriList[2]=/save
+spring.encrypt.responseEncryptUriList[3]=/encryptEntityXml
+spring.encrypt.responseEncryptUriList[4]=/decryptEntityXml
+#spring.encrypt.urlPatterns[0]=/user/*
+#spring.encrypt.urlPatterns[1]=/save/*
\ No newline at end of file
diff --git a/encrypt-springboot-example/target/classes/com/cxytiandi/encrypt_springboot_example/App.class b/encrypt-springboot-example/target/classes/com/cxytiandi/encrypt_springboot_example/App.class
index e381b946394df7276a1af9ab181cbf51b477d11c..3b205372239731480dd7a029b34b8d67730f4858 100644
GIT binary patch
delta 102
zcmX@j+RMgu>ff$?3=9m046+-!?lUr3`%DxN)zmL8D9X%BPs-0P(NE0F%P&bR$;{8w
zcg;&o%1L$2OD?J`D6wW_u=APtM{+U?QxqfDEOfyT-(
GFaQ9@2OOmU

delta 53
zcmeBWJI%^<>ff$?3=9m03^E(J?lUsk`AqyHIoXLRijjTtTqb)~E(Uf6?#U0C6xrDr
J7#XA)7y!TV4O0LB

diff --git a/encrypt-springboot-example/target/classes/com/cxytiandi/encrypt_springboot_example/config/FilterConfig.class b/encrypt-springboot-example/target/classes/com/cxytiandi/encrypt_springboot_example/config/FilterConfig.class
index cb715487e9525007973524286912b9e833d52c58..89bf214d71cc19881e6882a68bf77028c6dbcc8a 100644
GIT binary patch
delta 635
zcmYjNOLNjt7(F)$a7k0dw6q9)DcUNDO?j18tEF06AM~M7$Be7kMnoYx5IV!ED}O-e
zZr!@Co79oftuy`sw{HCtju)_wi~D_Z&pqEc=exhoyc?Fk|Ni_HKn9OL$|b_Sk%}}z
zpdCeHEFwkOia=8;!W3f!QTzGczVl)slg;G|i^Zj787krm&LP37Lh8u`r@XQcY@=?w
zRm1d}HMdGJMG!Dr_JKn&LvYsEclMf{w_e%xYF_7Qqb}nDE{2dg9d3KIy0O-5+MSky
zOPFOpg&b9JS-};gSyIfd>jXoFV}Uyy5!@&e$1T($h@Zebp#Znh#-a(#;}QT>>!S3
qNZ=)sa4~@vCNaeMGlSGnFwAch4bI%z
zQJ9>Xjv&p0v#3{sU#^ts>p1Bkx+jgyz<@pgz5)`ROit!iVtLcAmeQ;A_3
zGa|ycM^E?(p@2CN^H`ui`K+`^z^U10=#q$KtkB_*l7GbX{ViivomP?po`@(RO%P%2
ztQiMpGi*)7IyUIr(EHw0saiJd9mBPZJ=@%>ADUau7Xq8c$;|(j)gK<@2@14Ah7*fb
zXWy#ST*GHIi*zBpam+(v>*vq`nb|fFTxK@Ho^z&#XSQ~Rq<)H2DJOR|(31;)#Z{e`
z`!zizU(-G#)4;8q5Ww3_sA_t+dEF+DYI>yQGj@goOEa~qoMBqeoub<a2O*0`F@L
zJW%9^4Lnvt4Xi4kSY;kDc4q&aG6dFHf-NkAPOKosM$&~B=)o)W!eRfIhcx2Me<0`@
oBHG!PfCD_mCeyW!A!yiQTDKV&1CnNFhanEn804^fF$Nv@4fIN>U;qFB


From 43deca8dec3c57af788586c4a590c05608adb3fa Mon Sep 17 00:00:00 2001
From: yinjihuan 
Date: Thu, 24 Jan 2019 22:04:33 +0800
Subject: [PATCH 4/6] =?UTF-8?q?spring=20boot=E4=B8=AD=E6=94=AF=E6=8C=81?=
 =?UTF-8?q?=E6=B3=A8=E8=A7=A3=E6=A0=87=E8=AF=86=E5=8A=A0=E8=A7=A3=E5=AF=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 encrypt-core/pom.xml                          |   6 +
 .../encrypt/core/EncryptionConfig.java        |  10 ++
 .../encrypt/core/EncryptionFilter.java        |  17 ++-
 .../HttpMethodTypePrefixConstant.java         |  13 ++
 .../springboot/annotation/Decrypt.java        |  26 ++++
 .../springboot/annotation/Encrypt.java        |  25 ++++
 .../EncryptAutoConfiguration.java             |   6 +
 .../springboot/init/ApiEncryptDataInit.java   | 120 ++++++++++++++++++
 .../encrypt/core/EncryptionConfig.class       | Bin 3035 -> 3224 bytes
 .../encrypt/core/EncryptionFilter.class       | Bin 5736 -> 6418 bytes
 .../controller/UserController.java            |   6 +
 .../controller/UserController.class           | Bin 2611 -> 2671 bytes
 12 files changed, 227 insertions(+), 2 deletions(-)
 create mode 100644 encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/HttpMethodTypePrefixConstant.java
 create mode 100644 encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/annotation/Decrypt.java
 create mode 100644 encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/annotation/Encrypt.java
 create mode 100644 encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/init/ApiEncryptDataInit.java

diff --git a/encrypt-core/pom.xml b/encrypt-core/pom.xml
index e5e5558..94ba0fb 100644
--- a/encrypt-core/pom.xml
+++ b/encrypt-core/pom.xml
@@ -43,6 +43,12 @@
 			5.0.10.RELEASE
 			provided
 		
+		
+			org.springframework
+			spring-web
+			5.0.10.RELEASE
+			provided
+		
 		
 			org.springframework.boot
 			spring-boot-autoconfigure
diff --git a/encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionConfig.java b/encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionConfig.java
index 45b0431..9ace2b5 100644
--- a/encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionConfig.java
+++ b/encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionConfig.java
@@ -5,6 +5,8 @@
 
 import org.springframework.boot.context.properties.ConfigurationProperties;
 
+import com.cxytiandi.encrypt.springboot.init.ApiEncryptDataInit;
+
 /**
  * 加解密配置类
  * 
@@ -80,6 +82,10 @@ public void setKey(String key) {
 	}
 
 	public List getResponseEncryptUriList() {
+		// 配置了注解则用注解获取的URI
+		if (ApiEncryptDataInit.responseEncryptUriList.size() > 0) {
+			return ApiEncryptDataInit.responseEncryptUriList;
+		}
 		return responseEncryptUriList;
 	}
 
@@ -88,6 +94,10 @@ public void setResponseEncryptUriList(List responseEncryptUriList) {
 	}
 
 	public List getRequestDecyptUriList() {
+		// 配置了注解则用注解获取的URI
+		if (ApiEncryptDataInit.requestDecyptUriList.size() > 0) {
+			return ApiEncryptDataInit.requestDecyptUriList;
+		}
 		return requestDecyptUriList;
 	}
 
diff --git a/encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionFilter.java b/encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionFilter.java
index 188c181..d530e90 100644
--- a/encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionFilter.java
+++ b/encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionFilter.java
@@ -75,8 +75,9 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
 			return;
 		}
 		
-		boolean decryptionStatus = encryptionConfig.getRequestDecyptUriList().contains(uri);
-		boolean encryptionStatus = encryptionConfig.getResponseEncryptUriList().contains(uri);
+		
+		boolean decryptionStatus = this.contains(encryptionConfig.getRequestDecyptUriList(), uri, req.getMethod());
+		boolean encryptionStatus = this.contains(encryptionConfig.getResponseEncryptUriList(), uri, req.getMethod());
 		
 		// 没有配置具体加解密的URI默认全部都开启加解密
 		if (encryptionConfig.getRequestDecyptUriList().size() == 0 
@@ -147,6 +148,18 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
 		
 	}
 
+	private boolean contains(List list, String uri, String methodType) {
+		if (list.contains(uri)) {
+			return true;
+		}
+		String prefixUri = methodType.toLowerCase() + ":" + uri;
+		logger.debug("contains uri: {}", prefixUri);
+		if (list.contains(prefixUri)) {
+			return true;
+		}
+		return false;
+	}
+	
 	@Override
 	public void destroy() {
 		
diff --git a/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/HttpMethodTypePrefixConstant.java b/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/HttpMethodTypePrefixConstant.java
new file mode 100644
index 0000000..cde7c27
--- /dev/null
+++ b/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/HttpMethodTypePrefixConstant.java
@@ -0,0 +1,13 @@
+package com.cxytiandi.encrypt.springboot;
+
+public class HttpMethodTypePrefixConstant {
+
+	public static final String GET = "get:";
+	
+	public static final String POST = "post:";
+	
+	public static final String DELETE = "delete:";
+	
+	public static final String PUT = "put:";
+	
+}
diff --git a/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/annotation/Decrypt.java b/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/annotation/Decrypt.java
new file mode 100644
index 0000000..d09e83e
--- /dev/null
+++ b/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/annotation/Decrypt.java
@@ -0,0 +1,26 @@
+package com.cxytiandi.encrypt.springboot.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * 解密注解
+ * 
+ * 

加了此注解的接口将进行数据解密操作

+ * + * @author yinjihuan + * + * @about http://cxytiandi.com/about + * + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface Decrypt { + + String value() default ""; + +} diff --git a/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/annotation/Encrypt.java b/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/annotation/Encrypt.java new file mode 100644 index 0000000..4510ff2 --- /dev/null +++ b/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/annotation/Encrypt.java @@ -0,0 +1,25 @@ +package com.cxytiandi.encrypt.springboot.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 加密注解 + * + *

加了此注解的接口将进行数据加密操作

+ * + * @author yinjihuan + * + * @about http://cxytiandi.com/about + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface Encrypt { + + String value() default ""; + +} diff --git a/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/autoconfigure/EncryptAutoConfiguration.java b/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/autoconfigure/EncryptAutoConfiguration.java index b11558e..7e5f656 100644 --- a/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/autoconfigure/EncryptAutoConfiguration.java +++ b/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/autoconfigure/EncryptAutoConfiguration.java @@ -6,8 +6,10 @@ import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; + import com.cxytiandi.encrypt.core.EncryptionConfig; import com.cxytiandi.encrypt.core.EncryptionFilter; +import com.cxytiandi.encrypt.springboot.init.ApiEncryptDataInit; /** @@ -45,4 +47,8 @@ public FilterRegistrationBean filterRegistration() { return registration; } + @Bean + public ApiEncryptDataInit apiEncryptDataInit() { + return new ApiEncryptDataInit(); + } } diff --git a/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/init/ApiEncryptDataInit.java b/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/init/ApiEncryptDataInit.java new file mode 100644 index 0000000..540b740 --- /dev/null +++ b/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/init/ApiEncryptDataInit.java @@ -0,0 +1,120 @@ +package com.cxytiandi.encrypt.springboot.init; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import com.cxytiandi.encrypt.springboot.HttpMethodTypePrefixConstant; +import com.cxytiandi.encrypt.springboot.annotation.Decrypt; +import com.cxytiandi.encrypt.springboot.annotation.Encrypt; + +public class ApiEncryptDataInit implements ApplicationContextAware { + + private Logger logger = LoggerFactory.getLogger(ApiEncryptDataInit.class); + + /** + * 需要对响应内容进行加密的接口URI
+ * 比如:/user/list
+ * 不支持@PathVariable格式的URI + */ + public static List responseEncryptUriList = new ArrayList(); + + /** + * 需要对请求内容进行解密的接口URI
+ * 比如:/user/list
+ * 不支持@PathVariable格式的URI + */ + public static List requestDecyptUriList = new ArrayList(); + + @Override + public void setApplicationContext(ApplicationContext ctx) throws BeansException { + Map beanMap = ctx.getBeansWithAnnotation(RestController.class); + if (beanMap != null) { + for (Object bean : beanMap.values()) { + Class clz = bean.getClass(); + Method[] methods = clz.getMethods(); + for (Method method : methods) { + if (method.isAnnotationPresent(Encrypt.class)) { + // 注解中的URI优先级高 + String uri = method.getAnnotation(Encrypt.class).value(); + if (!StringUtils.hasText(uri)) { + uri = getApiUri(clz, method); + } + logger.debug("Encrypt URI: {}", uri); + responseEncryptUriList.add(uri); + } + if (method.isAnnotationPresent(Decrypt.class)) { + String uri = method.getAnnotation(Decrypt.class).value(); + if (!StringUtils.hasText(uri)) { + uri = getApiUri(clz, method); + } + logger.debug("Decrypt URI: {}", uri); + requestDecyptUriList.add(uri); + } + } + } + } + } + + private String getApiUri(Class clz, Method method) { + String methodType = ""; + StringBuilder uri = new StringBuilder(); + + if (clz.isAnnotationPresent(RequestMapping.class)) { + uri.append(formatUri(clz.getAnnotation(RequestMapping.class).value()[0])); + } + + if (method.isAnnotationPresent(GetMapping.class)) { + + methodType = HttpMethodTypePrefixConstant.GET; + uri.append(formatUri(method.getAnnotation(GetMapping.class).value()[0])); + + } else if (method.isAnnotationPresent(PostMapping.class)) { + + methodType = HttpMethodTypePrefixConstant.POST; + uri.append(formatUri(method.getAnnotation(PostMapping.class).value()[0])); + + } else if (method.isAnnotationPresent(RequestMapping.class)) { + + RequestMapping requestMapping = method.getAnnotation(RequestMapping.class); + RequestMethod m = requestMapping.method()[0]; + methodType = m.name().toLowerCase(); + uri.append(formatUri(requestMapping.value()[0])); + + } else if (method.isAnnotationPresent(PutMapping.class)) { + + methodType = HttpMethodTypePrefixConstant.PUT; + uri.append(formatUri(method.getAnnotation(PutMapping.class).value()[0])); + + } else if (method.isAnnotationPresent(DeleteMapping.class)) { + + methodType = HttpMethodTypePrefixConstant.DELETE; + uri.append(formatUri(method.getAnnotation(DeleteMapping.class).value()[0])); + + } + + return methodType + uri.toString(); + } + + private String formatUri(String uri) { + if (uri.startsWith("/")) { + return uri; + } + return "/" + uri; + } +} diff --git a/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionConfig.class b/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionConfig.class index 621f5decc762b341ad705bb51ac84f68da83bc70..44ad74feb5e254650415caee23f4668e29a29712 100644 GIT binary patch delta 725 zcmaiwO-~b16o%j1>2<#NunBELH?&$zm1u(>5fc%LtypZOvzXe%oBBGf0WUS%&tKW7O{C4QtYN}Gt~%Zq{*6yN0pp8!WuG}N$2DUrExFj_#@D-3O8gy98b`rJD520dF;m(WjV2i?FF zbWEcYGeico{d|WLlqSf{)v``1W-$gIR4VvzNjz5$@(NkbdX`_5$ip0s^SghJ#syj+ z@_!)mE=25ah$=zU2%`RPh|8@Io=JgBePkv|YKWUeG*3kRY+QVhgW|0kV0Yb!SV8Q` zA@NNO@Oz|bdel)(ktQg#J}u6cT$NP9q`0m1@@3MjxEj5kLUNDI~R J2JJZ;#t$;zfzbc} delta 589 zcmaixOD{t~6vzM9y+b>;@89KA7j%-o6M>d~OMc`Q)e73e;-;VSsYK0hIgMLtc|FY#V3 GBKHBCy--O2 diff --git a/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionFilter.class b/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionFilter.class index 8ac3bef67ce2fd69238dc71f35e924fedf81eea3..b8f18741500e8b0d7540c0060a0bcd23e4aabb36 100644 GIT binary patch delta 2244 zcma)7X>=1+6#j0Kc9O|!%F+U(R1gsZZAAsC#^rdhxE#u68Z2BuyriiW*sD z6%d9ZWfxhhR;23Q>W`VZ@80j-^?Pp)m9_;ncA@U84j=Eg%}pg{3(Ub>^IS(R%{O&Nuk-~1 z3$e(Y=O}P5CY+G0Cg2TD7&tN(H2f9%uqi%0Z1_V#6?ejv6)ZImI&y5w2!qYrG6rX= zsKIinuO;NVi_FK;dYcuhGra~Y1y-52s@(>xNtP51hl0ASQRX7^Ung)kW)KuT=!ofGou%Itg>JLtEq7DxT zJcx(PLg)D>HDIfPhY6iJDj8)&7$>j|+s!r3evU>oDcC_c*(7InS#it=#|*~k-U@+c z>?EXBMf?VjFU@_;(EelXc$Cni)m+fpymWufmi-GJY@N5R^`Tj<8yXI5+o+-uy9FMD zi}7WFShQSfo)CC4sqqCuQC-2)TQ3tAT5S6WJvnH1^MFx;zr9@{SL1 z;Nfnw!8$~;EdEV_#EHKA`_?ao`4Ttq$DIwp@Dfb+0G>)zga~mAth+gKOGA80Tce_TDeQQ?cLW^S|Y{&%YNAv#9=M)auhCT^gr=@GQ zCU}W^Uphn?(55Z_o7SF!HenKB1$v|~yfjbjk{_=u(QJ)~dQ?qKV6w-_<{n+DHD?ow zt>8tDCRH43Y7=g?!XuJ^nVLufG*uG`%-W2eDZ@NzxWkH_xU)nPjaaff+g=OTPSliW zX^ptc zriu1!Hzcqnfy8E<;mJs5{D_v(kywUI%;VC;9%N`@Py)MT8INnO-6>VOrU6#$VYYmS zrzl9)}*W7q9M&Js*QAZ(y(U^uYn2E8Njd56vYp@d6Vij)0T6nRZQJYbU zhoPg1NxcW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!_vShcu+gJ={NF8VN$$^sToaG!&w#YQTS2`fT7L#OWD|H{wr kcy!0F*uQ$aNw)@}di6<6skdijTJz9P*NlX#8pUw!PaN5p2><{9 diff --git a/encrypt-springboot-example/src/main/java/com/cxytiandi/encrypt_springboot_example/controller/UserController.java b/encrypt-springboot-example/src/main/java/com/cxytiandi/encrypt_springboot_example/controller/UserController.java index 319d563..1f99015 100644 --- a/encrypt-springboot-example/src/main/java/com/cxytiandi/encrypt_springboot_example/controller/UserController.java +++ b/encrypt-springboot-example/src/main/java/com/cxytiandi/encrypt_springboot_example/controller/UserController.java @@ -7,17 +7,21 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import com.cxytiandi.encrypt.springboot.annotation.Decrypt; +import com.cxytiandi.encrypt.springboot.annotation.Encrypt; import com.cxytiandi.encrypt_springboot_example.dto.UserDto; import com.cxytiandi.encrypt_springboot_example.dto.UserXmlDto; @RestController public class UserController { + @GetMapping("/encryptStr") public String encryptStr() { return "加密字符串"; } + @Encrypt @GetMapping("/encryptEntity") public UserDto encryptEntity() { UserDto dto = new UserDto(); @@ -26,6 +30,8 @@ public UserDto encryptEntity() { return dto; } + //@Encrypt + //@Decrypt @PostMapping("/save") public UserDto save(@RequestBody UserDto dto) { System.err.println(dto.getId() + "\t" + dto.getName()); diff --git a/encrypt-springboot-example/target/classes/com/cxytiandi/encrypt_springboot_example/controller/UserController.class b/encrypt-springboot-example/target/classes/com/cxytiandi/encrypt_springboot_example/controller/UserController.class index 52d65f15fbdd031b8b78a48dc0d8201ffab2cfe4..f83f08bfde924d03a16c127052d7be6d34c758cc 100644 GIT binary patch delta 987 zcmZXSO;giQ6o%g$LK8#4TA)aQiUPH@K;)x9MG#TcA|eW+6;T4zS_e{w#t$~KbK%Ct zb?xZ57m+cjjQ#-sg)?@>o&SLGBtZ+h$UXP#ocBG?%|^wq3h%e=&tCzwAtOOx801Wd ztj9MPi}CM*zeCF{EoY4MY&L6Zx?yBZ-O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=A0spring=20mvc=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../encrypt/core/EncryptionFilter.java | 6 ++ .../springboot/init/ApiEncryptDataInit.java | 11 ++- .../target/classes/META-INF/MANIFEST.MF | 4 +- .../encrypt/core/EncryptionFilter.class | Bin 6418 -> 6580 bytes .../core/EncryptionReqestWrapper$1.class | Bin 1261 -> 1271 bytes .../core/EncryptionReqestWrapper.class | Bin 1670 -> 1683 bytes .../core/EncryptionResponseWrapper$1.class | Bin 1256 -> 1268 bytes .../core/EncryptionResponseWrapper.class | Bin 1348 -> 1365 bytes .../encrypt/util/AesEncryptUtils.class | Bin 2924 -> 2922 bytes .../StreamUtils$NonClosingInputStream.class | Bin 648 -> 648 bytes .../StreamUtils$NonClosingOutputStream.class | Bin 855 -> 855 bytes .../cxytiandi/encrypt/util/StreamUtils.class | Bin 4118 -> 4097 bytes .../target/classes/META-INF/MANIFEST.MF | 4 +- .../encrypt-springboot-example/pom.properties | 4 +- encrypt-springmvc-example/pom.xml | 92 ++++++++++++++++++ .../mvc/controller/UserController.java | 31 ++++++ .../java/com/cxytiandi/mvc/dto/UserDto.java | 25 +++++ .../mvc/filter/ApiEncryptionFilter.java | 39 ++++++++ .../src/main/resources/springContext.xml | 40 ++++++++ .../src/main/webapp/WEB-INF/web.xml | 39 ++++++++ .../src/main/webapp/index.jsp | 5 + 21 files changed, 292 insertions(+), 8 deletions(-) create mode 100644 encrypt-springmvc-example/pom.xml create mode 100644 encrypt-springmvc-example/src/main/java/com/cxytiandi/mvc/controller/UserController.java create mode 100644 encrypt-springmvc-example/src/main/java/com/cxytiandi/mvc/dto/UserDto.java create mode 100644 encrypt-springmvc-example/src/main/java/com/cxytiandi/mvc/filter/ApiEncryptionFilter.java create mode 100644 encrypt-springmvc-example/src/main/resources/springContext.xml create mode 100644 encrypt-springmvc-example/src/main/webapp/WEB-INF/web.xml create mode 100644 encrypt-springmvc-example/src/main/webapp/index.jsp diff --git a/encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionFilter.java b/encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionFilter.java index d530e90..40a0191 100644 --- a/encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionFilter.java +++ b/encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionFilter.java @@ -50,6 +50,12 @@ public EncryptionFilter(EncryptionConfig config, EncryptAlgorithm encryptAlgorit this.encryptAlgorithm = encryptAlgorithm; } + public EncryptionFilter(String key) { + EncryptionConfig config = new EncryptionConfig(); + config.setKey(key); + this.encryptionConfig = config; + } + public EncryptionFilter(String key, List responseEncryptUriList, List requestDecyptUriList, String responseCharset, boolean debug) { this.encryptionConfig = new EncryptionConfig(key, responseEncryptUriList, requestDecyptUriList, responseCharset, debug); diff --git a/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/init/ApiEncryptDataInit.java b/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/init/ApiEncryptDataInit.java index 540b740..b41daec 100644 --- a/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/init/ApiEncryptDataInit.java +++ b/encrypt-core/src/main/java/com/cxytiandi/encrypt/springboot/init/ApiEncryptDataInit.java @@ -10,6 +10,7 @@ import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Controller; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; @@ -44,7 +45,13 @@ public class ApiEncryptDataInit implements ApplicationContextAware { @Override public void setApplicationContext(ApplicationContext ctx) throws BeansException { Map beanMap = ctx.getBeansWithAnnotation(RestController.class); - if (beanMap != null) { + initData(beanMap); + beanMap = ctx.getBeansWithAnnotation(Controller.class); + initData(beanMap); + } + + private void initData(Map beanMap) { + if (beanMap != null) { for (Object bean : beanMap.values()) { Class clz = bean.getClass(); Method[] methods = clz.getMethods(); @@ -69,7 +76,7 @@ public void setApplicationContext(ApplicationContext ctx) throws BeansException } } } - } + } private String getApiUri(Class clz, Method method) { String methodType = ""; diff --git a/encrypt-core/target/classes/META-INF/MANIFEST.MF b/encrypt-core/target/classes/META-INF/MANIFEST.MF index 9712488..cda5ee7 100644 --- a/encrypt-core/target/classes/META-INF/MANIFEST.MF +++ b/encrypt-core/target/classes/META-INF/MANIFEST.MF @@ -1,5 +1,5 @@ Manifest-Version: 1.0 -Built-By: yinjihuan -Build-Jdk: 1.8.0_40 +Built-By: user +Build-Jdk: 1.8.0_45 Created-By: Maven Integration for Eclipse diff --git a/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionFilter.class b/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionFilter.class index b8f18741500e8b0d7540c0060a0bcd23e4aabb36..56f96711a0fb9f43f641d2de2225592e0e1f38c8 100644 GIT binary patch delta 2825 zcmZuz3wV>&8GgUq{#;Iy($dLd@B9g@6P`Z(&pF?Dzx(B6 zb7j}1SudUGeG$L}vS~08$|ZS5cUFC5GUb-Y@!lL?qZ7k1R^Sqp6KwHdVovaOf_a(x zX4fqZtO)qRfk>-wej*l%v`&`A=3}-h0XN1=ujLKP3__87MdV7d?izMAA;;hdMSZpP zvsN_++Y+H@M8jW39e;xMjjpUtP4dH5e1{<9foyC33j8P;RlgXEq7kh=l|#6t4*` zZf|7|N=k2Z;bweQ!y z6}004fd^H>J)H1CqU_ixpL7%sy$%lxJc7*xYcLjz#*}SFtUq*k=uvsvG2AZkxH5Z- z9N{daZSr#GB>PruSELkkW8~OYF;qF3^pG@-^2OM=!pwp^q@aDD#~jkuUH9UgXfM zjD-@MQESP<8KsSO9G25W;pkrcP~b=KFuf(*9$(@_FMc9$#Go{Xqw%1IpYC5PrkUuE z@{nf)y({1LwAkD5XH`=l$a?QE`cN+Q78G~kBZ0pv2VIG1U34WEY#<(Vq6>c$_ym8K zd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r$+P@4?xW|hlkwb7FX91u8N28e?55YyMX&SzP2RuF`wKjNRp%bVDAf+b4aC%0 zJjd;$c;ChMR3|d^JigD-v9jh5@I!7PLGknW5nkZd_0bT1%^MZVcnLp)gX6FeKW7amM`8?KW=e1zuEH;PFBsuN_?0@Pc5K71@e1=! zr%zpYm9IPq_hrPVYnY{Bj)vY#s3972g)<>EkcQuAIHIBcU+2WUy&5`LR2@J20sNk< zQSK|864(Dy(73;q&QcA(y#g;h!wT{L=0a((FmQ!q_kY>PMYvg(|84M^n!mqOLyE&| zGG=aN0k^~NGtdo-`B*>B)fXiYKYt2;>ccyke@Wm%A^#Hid%$dT{y)@Y;sI8mzQby! zV{FiD4DuYlAMh||qMIYXA9-A@Wq6e5=3_iF4;p1rnsPi`7TgM#czCOUUTI`IL-j}{ zE_0$xY+xLtRTEv!agi3g#C=3Y!tBTpAEL~NKS6ftx!F$`UQ(jN)0;@y&!CKd0?Y1G AW&i*H diff --git a/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionReqestWrapper$1.class b/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionReqestWrapper$1.class index 9e9240726fce7ec5d4fe4c74c772e3045bb83ba2..e136163a63980810d3f946595f5ab5d180afaeb6 100644 GIT binary patch delta 560 zcmZut%}N4c6g}TJ<~Ta$l&SrgS!wBHjYtu+X(17=+PSwdFiImM+W81E%v(g8Ad4b; zfS#b2Xx%P4pNWVy!@c*+oqNu`oKNG+$h?2QyaCum(ZCp%Rmue6M>dERtm??=$h)_W zd$#L-9D9eNXquH~vwl%Nt+m^A??zOG?d9Za(nJC4CJY2k=m?kyVMB*wB8n+DyzTC1 z6Va2}Rn2L%oXWx8^-=x&ve9Y^lw7OirL-Mg%jK&AN%uL~L7I2?d6%>-r3SE4nw>F5 z2qpx=L}f^5tPy*y3t<#sBYbzn!&2#`OW9Z=N;oPGc!`ga*$^oW$>l!T4WsfX z>imnYATwyX6_})%MhCA1V2UOX1NR3PDvKONj@1CnqmU*c!y)@+QsR5XC(!x>EWkDt diff --git a/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionReqestWrapper.class b/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionReqestWrapper.class index 40ada5e213026092065fd0da759499e55ec0e991..c6822202a1e098d37be1a8dc2be4817e3babb506 100644 GIT binary patch delta 804 zcmYjPOHUI~6#ni^%k2y^QUQ6kfFjVDBH)9!FN&xb@DT_}Wi^tDC>GK-J{RoVH+S#C zjd5cnQBiAj@6Np||ABu%{qD3u=O*W#d(QbDIhkj!a#z3o{`3XFDO|A;$B2an9IwX- zoU~aRl^By4w^4@)iAftVOi4`JuyI=Aj131 zo_b*<)QC}Nb(c!P+P%eKdpWqZnF}E^6i}|1P_InC-ky83mfJ3EY~_pUyO~nW5l>|! z*E$?DcW@c=Wp~sR7*tP;zVdym{Ig#z3Qs*1L%jlRsfB--56I;)fGLK8SqCh0&t!8kTtBZ4$0*3a=EW(`D8C&>z4wDBM@Y8z`zWF)! z4u+rp2pai-2p=!uE>=*N9o&Qbx=WaYb|erbtd+nnNXACK8{q7axt-+%`IF@DM;i~& z!{H<>_B!Z;YUt#Q{svg@B561CCK!KMHY9o^jSGn*7F%2`LE7w9n%D4_3SwFREsQ-_ z3l-Q|ZNB~uu*0@CWrt%4T1|%fEmc@e)nUJn-UQXF`-n16!DG}iV{|KcI~6!J8JFZW z?z*ry8uB{Txf-v)Z6E0x$qdJ}SIbYo#{uqfcb}o^Zc_iZ|GBgFcVb}>$4FyfD8vlo LAa9!$n>W9|J{N7! literal 1670 zcmbVM+fvg|6kWSiLPHScreG0J)LxJP;sxuC0$ygS&IsZ#JcV!uq9v)xsnTEZ2Yl5T z6%|L{{U~*xB({}7N6o{z?8`c9uk3Tae*5?tz%*`YND!uMZ_Bi|YtpgYb;lI0?bj;O zv^`(>~$+y~;R2;?K*s#JupAxRi}Y(2BK%|Q6i%0il(QdZ2{JS;{APN+6A2&?Bl5^g=(9wc+0~*>=AaocwfYx?&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--git a/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionResponseWrapper.class b/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionResponseWrapper.class index fd48454f4f1b9e11daae505b0902f5be18875126..936ab5c42c2839a78208c89621c7053069190e65 100644 GIT binary patch delta 620 zcmZ9KO-mb56o%hB*JQ@)L?@14{fM8@n(-qsm8y#_ij?9)x=0ZOU5sInw33Jus<_E- z2(xkJZ&0WWD0EdQbl*jPNVn4W-n2z}hdJlocg}gW7%(Jc`3wyvQ{>+A{Y*Xm7?rp0+uv#heWmIE7nK?|5}W~Cc{U; zSh!@d_m9OBQ!9KtMtQ`< zkU+6}v1-0=h0SKv>h6AZZ5T*77=>+OOdy-QmDyPvX?O}87ckZfN23s!aA3mf{`tLS z?|rF8&33I(k4@wR{FCr=SgJKj`|ln*im~Wm7<64qe#xDbjXYMA=BmI>;>kDOkwB`_ z4y&gJVe>HjcoroOqL5SG8xA&65U|>fO1o97e_|O{t5F;;Cn@%8bK> zk11kPeG;aT;S1<^n87SH1?KRQ%`8FXG_PGMx&|`AB^G{Qj6V6}poirvEGXz3rwu%r zP4l=JS{1aJLmhGlW@~y@_ypHE&|jmo%|cCCl=H6Jl1reyV%Tnk0K8VIZm a_`{0-KRK<*>P!+P9baRMSsgLY4Ca4{woY>Z diff --git a/encrypt-core/target/classes/com/cxytiandi/encrypt/util/AesEncryptUtils.class b/encrypt-core/target/classes/com/cxytiandi/encrypt/util/AesEncryptUtils.class index b75a43fb241e6495f5d4ed9e24627008896007e6..582a3bce1f9c1d1caaf4fe9098d357068b589d74 100644 GIT binary patch literal 2922 zcma)8S$7j<7=ETrn>0*?rW-9gWl1-tU|T96+LQpL3zd{=t=nWWqyybh!vUB3^mr@37~1=RffHd^6K5Z9H<3Z{~ZycX{6Dd*65R$3MUP2B06` z_^}sf{g}a%VtLAkSwEh}oLHXm;#nV_^TUtly?DV3)sH4b{a6Q02xC6zLUK-Q;(mBB zFBZd#^Fn+i~!5(4Ar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wTezAr|CdCiOB>T?^gsA z#Jl2+wOlSAy*!jG5q^Nb!>;9<|G?!wGebg5*3y@mIdi`A?QidIpL2fy``5bwI`OR^ zH40jd)S_lAhpXFdh>M@-AK`v@71%qZ{;rs5)qS~RI> z!~+UekC~R3$SuZ1W?GLWg{&%N=*by9W6H7j(`PT3Sq1H5|DQX#s4+b&x;v=|Q5Cd= z=LRB`oP*ei&3EsF=i* z0)ISpf)-42LrD`$)A)^)Webaf1-&DHxv1Xxgs>EBc5sTa-QPEEjC#Y7QNg-BVsGHQ1=SF2AvT2;F z|KrZhmGAE~AdQS4&y`yzpS8uJiY(-jo67O&>aCe6ZHniuO%$Oo(w!IRjnbxfJvWdu zlW~y=V2Ko0uH0Pt@#4zmtAG7=BZwSckQ%(mgjISYcTWy4t9S*kvO+zb7FJwAN43xj zVje0tW)82bcmr?J_IAoGiN}1n>IwQb-tpt&y_2h)o{CGdQh!=9PFhm!D=MDA8EN(R zR9wY1R+$u5!d`Ihi4i$*UBw6ZkjpN}duVcAQXQ#+9l*!Dv<`dvT)*b%qu^5&0%rpF zoZ9{Q!*^0UXO2zPGYKBh%~g6zG|x)>@{B`EL{qtpAx@a`c3RtCJYJm}cAxATc92so zujm?VLLKTk@;jpd$HDu?s}SHEFFrn3GeYBA;k&N&7S{aiED7-`6M&)3e5!5$)?yt; z4RQVxA07vMIJMVi*ztcrQ%;_WXU@%tF-(RG^%cI{;$Hf`vqY&Hz6*ZTHC}5siER@P{ zg=j4k;+#{O?79otfb&RJB)v;G+5NMj#j#(Ix{cgy==od7v*#}@ODDY5777$_dEA?9 zU&gxyyw8ZxM-1W63u~8QpG@4#@fjmJij$=svensO``B%b4mm(uAH*@rG>k4bs@q}U ldgd&?zztSbi#eyM3S;~5C0W%ldOc(dYboW|jH$sl{{X+CqZ$AJ diff --git a/encrypt-core/target/classes/com/cxytiandi/encrypt/util/StreamUtils$NonClosingInputStream.class b/encrypt-core/target/classes/com/cxytiandi/encrypt/util/StreamUtils$NonClosingIn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+z2 zmesdJzC)e){162Xmzfb?EQK8Ok7@R1ShJbUmaO}XZC2{d&$!xJTKnphZmt2e30x!Qsiur(#rGPhVo(WjE!;Xbjtnux# KC%B7yaDM@8iMXHu diff --git a/encrypt-core/target/classes/com/cxytiandi/encrypt/util/StreamUtils.class b/encrypt-core/target/classes/com/cxytiandi/encrypt/util/StreamUtils.class index 375a450afd1d29a8eb38e3cb41f1be90ad16f386..ee7bddc67d58680c8c09c8a11c6cf6d23ac79ee2 100644 GIT binary patch literal 4097 zcmb7H>r)%|6+J5ntyswz^AKRb$k@gp!15yn#~2!;;1mkN;pNJtv4vQSjF7OjN=%zJ zZQ7)HxJ@6f`*L1=(MLLywlmNvne=04`cL#@ryu*ZlZKwVyNFdRdlJvE+Wr0R@7#OO zJ@@YVA0Peo0|1ZU_Zm8oQgK7YiUt?b8r)cwyNnN66>A!NvVT*9hMZjTvSP@kpy3%j ztKyc1YOHJc622^#=QMl;UzNS*k5LgY$lq{=2MyLlLcd~U`!i1J+Z1FFq+BexoA3(&+B;w z^?P=s8HbsFc=qDOk*TZGqgO^0D5DDYMYEZ_k;oWxiF84Cg9&hPWa83H{AzSEHZu~N zQQ(>%R^UCK%A|}T1@6wSIR&0*c2QTbe>|1ZV};cPJvWnBNOPrTJey3U=MuS;Jll&N zV>!jRI>(dQ)kyNzx{*p`7E=*DlgzEJ8IgjKN=K|*W_g<*AaF9fwmy>`UN`g$xm;ph zK~v}Wjl?sFNGcm~BsI__!MRcyW?gol0cQ(_g0|vr5!1;bUGAGU63LZ`#F`znHgYSe zuNf&aM24++7$nJ85G@~!vy2b+Da!f*CkVe(4%TwDLDAxlg#|S zv%`f{dQs02!b<`0PC>I}RLahjxhZA~g{37ibInH;R4$O#ylkrYu8Qwb-c+`VCs zlW3ju!$rUno}~D}@>>cf*u6<_hyW@vwT3 zlhPC@e3OD`wvaJYMEEFaPq8>u@X1euH8$2Yrl5j7l%vQL-n;e8B1@ZJNv*Bvyz`r6 z&t#(}u@#HCgow4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3vUs%VN0`4{3ti82{uX4`K+OPA5MqJ0+e+{^TmSOhj zN`iC7D*D6q29xgg`n`^aaIfO5-}`1jzk44CTIvm_-%D)*I>)RYUCPC=fc_Q-Jw19r z_uRez_-_TwfNuS+q}Gtq;d#1zm@19%06Iq9qSR-c4!*>{FYx<5!9&0lOx|6?46>MI z!ZF;WiEeSm+jv=_Oi(SRTT=5*QB67a4&J3e^6ob8T#R=c-{75_(Pr>X-svi))Y>3s zr_$Q1v<|@i0lHlO!#)@F{s1+i;lJ>?Df_qZ?VYl7%%LpUq?8+V^f~)ip*1#K=?~K> z=~y2<^Pk2ozci5xXjV6K(`icsNw&6SW|U-eN~_EYrfw=`=4SJfJb4zUtE4BSsq2(u zoLlbLBh4YC%fEx~a<_43$Mw z2JXe!vwysE*)6rK(6c>7q7vXIy8#|ZfS>LJxV;TPHVDb<7wYdX@he_y`FxLXtIYNR IufK-ze`q0-zyJUM diff --git a/encrypt-springboot-example/target/classes/META-INF/MANIFEST.MF b/encrypt-springboot-example/target/classes/META-INF/MANIFEST.MF index 305ec72..a665844 100644 --- a/encrypt-springboot-example/target/classes/META-INF/MANIFEST.MF +++ b/encrypt-springboot-example/target/classes/META-INF/MANIFEST.MF @@ -1,9 +1,9 @@ Manifest-Version: 1.0 Implementation-Title: encrypt-springboot-example Implementation-Version: 1.1-SNAPSHOT -Built-By: yinjihuan +Built-By: user Implementation-Vendor-Id: com.cxytiandi -Build-Jdk: 1.8.0_40 +Build-Jdk: 1.8.0_45 Implementation-URL: http://maven.apache.org Created-By: Maven Integration for Eclipse diff --git a/encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.properties b/encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.properties index 34f5ee9..7764c11 100644 --- a/encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.properties +++ b/encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.properties @@ -1,7 +1,7 @@ #Generated by Maven Integration for Eclipse -#Wed Jan 23 22:52:09 CST 2019 +#Fri Jan 25 15:27:54 CST 2019 version=1.1-SNAPSHOT groupId=com.cxytiandi m2e.projectName=encrypt-springboot-example -m2e.projectLocation=/Users/yinjihuan/Documents/workspace_spring_cloud/jiamin/spring-boot-starter-encrypt/encrypt-springboot-example +m2e.projectLocation=D\:\\code\\monkey-api-encrypt\\encrypt-springboot-example artifactId=encrypt-springboot-example diff --git a/encrypt-springmvc-example/pom.xml b/encrypt-springmvc-example/pom.xml new file mode 100644 index 0000000..15d5fb2 --- /dev/null +++ b/encrypt-springmvc-example/pom.xml @@ -0,0 +1,92 @@ + + 4.0.0 + com.cxytiandi + encrypt-springmvc-example + war + 0.0.1-SNAPSHOT + encrypt-springmvc-example Maven Webapp + http://maven.apache.org + + 5.0.10.RELEASE + + + + org.springframework + spring-core + ${spring.version} + + + org.springframework + spring-web + ${spring.version} + + + org.springframework + spring-webmvc + ${spring.version} + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + + + com.fasterxml.jackson.core + jackson-core + 2.9.7 + + + com.fasterxml.jackson.core + jackson-databind + 2.9.7 + + + com.fasterxml.jackson.core + jackson-annotations + 2.9.7 + + + com.cxytiandi + monkey-api-encrypt-core + 1.1-SNAPSHOT + + + junit + junit + 3.8.1 + test + + + + + jitpack.io + https://jitpack.io + + + + encrypt-springmvc-example + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + org.apache.tomcat.maven + tomcat7-maven-plugin + 2.2 + + UTF-8 + / + 8333 + + + + + diff --git a/encrypt-springmvc-example/src/main/java/com/cxytiandi/mvc/controller/UserController.java b/encrypt-springmvc-example/src/main/java/com/cxytiandi/mvc/controller/UserController.java new file mode 100644 index 0000000..e798b14 --- /dev/null +++ b/encrypt-springmvc-example/src/main/java/com/cxytiandi/mvc/controller/UserController.java @@ -0,0 +1,31 @@ +package com.cxytiandi.mvc.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import com.cxytiandi.encrypt.springboot.annotation.Decrypt; +import com.cxytiandi.encrypt.springboot.annotation.Encrypt; +import com.cxytiandi.mvc.dto.UserDto; + +@RestController +public class UserController { + + //@Encrypt + @GetMapping("/encryptEntity") + public UserDto encryptEntity() { + UserDto dto = new UserDto(); + dto.setId(1); + dto.setName("加密实体对象"); + return dto; + } + + //@Decrypt + @PostMapping("/save") + public UserDto save(@RequestBody UserDto dto) { + System.err.println(dto.getId() + "\t" + dto.getName()); + return dto; + } + +} diff --git a/encrypt-springmvc-example/src/main/java/com/cxytiandi/mvc/dto/UserDto.java b/encrypt-springmvc-example/src/main/java/com/cxytiandi/mvc/dto/UserDto.java new file mode 100644 index 0000000..f083130 --- /dev/null +++ b/encrypt-springmvc-example/src/main/java/com/cxytiandi/mvc/dto/UserDto.java @@ -0,0 +1,25 @@ +package com.cxytiandi.mvc.dto; + +public class UserDto { + + private int id; + + private String name; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} diff --git a/encrypt-springmvc-example/src/main/java/com/cxytiandi/mvc/filter/ApiEncryptionFilter.java b/encrypt-springmvc-example/src/main/java/com/cxytiandi/mvc/filter/ApiEncryptionFilter.java new file mode 100644 index 0000000..7560625 --- /dev/null +++ b/encrypt-springmvc-example/src/main/java/com/cxytiandi/mvc/filter/ApiEncryptionFilter.java @@ -0,0 +1,39 @@ +package com.cxytiandi.mvc.filter; + +import java.io.IOException; +import java.util.Arrays; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import com.cxytiandi.encrypt.core.EncryptionConfig; +import com.cxytiandi.encrypt.core.EncryptionFilter; + +public class ApiEncryptionFilter implements Filter { + + EncryptionFilter filter = null; + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + EncryptionConfig config = new EncryptionConfig(); + config.setKey("abcdef0123456789"); + config.setRequestDecyptUriList(Arrays.asList("/save")); + config.setResponseEncryptUriList(Arrays.asList("/encryptEntity")); + filter = new EncryptionFilter(config); + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { + filter.doFilter(request, response, chain); + } + + @Override + public void destroy() { + + } + +} diff --git a/encrypt-springmvc-example/src/main/resources/springContext.xml b/encrypt-springmvc-example/src/main/resources/springContext.xml new file mode 100644 index 0000000..6165760 --- /dev/null +++ b/encrypt-springmvc-example/src/main/resources/springContext.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + text/plain;charset=UTF-8 + + + + + + + + + + + diff --git a/encrypt-springmvc-example/src/main/webapp/WEB-INF/web.xml b/encrypt-springmvc-example/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..37461be --- /dev/null +++ b/encrypt-springmvc-example/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,39 @@ + + + Archetype Created Web Application + + + dispatcher + org.springframework.web.servlet.DispatcherServlet + + contextConfigLocation + classpath:springContext.xml + + 1 + + + dispatcher + / + + + contextConfigLocation + classpath:springContext.xml + + + org.springframework.web.context.ContextLoaderListener + + + + 自定义加解密过滤器 + ApiEncryptionFilter + com.cxytiandi.mvc.filter.ApiEncryptionFilter + + + + ApiEncryptionFilter + /* + + \ No newline at end of file diff --git a/encrypt-springmvc-example/src/main/webapp/index.jsp b/encrypt-springmvc-example/src/main/webapp/index.jsp new file mode 100644 index 0000000..c38169b --- /dev/null +++ b/encrypt-springmvc-example/src/main/webapp/index.jsp @@ -0,0 +1,5 @@ + + +

Hello World!

+ + From 72dffe3d636042fcbcc0fa1ea85418dcdbcd76ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E5=90=89=E6=AC=A2?= Date: Fri, 25 Jan 2019 17:08:21 +0800 Subject: [PATCH 6/6] add gitignore --- .gitignore | 1 - encrypt-core/.gitignore | 32 ++++++++++ .../target/classes/META-INF/MANIFEST.MF | 5 -- .../encrypt/core/EncryptionConfig.class | Bin 3224 -> 0 bytes .../encrypt/core/EncryptionFilter.class | Bin 6580 -> 0 bytes .../core/EncryptionReqestWrapper$1.class | Bin 1271 -> 0 bytes .../core/EncryptionReqestWrapper.class | Bin 1683 -> 0 bytes .../core/EncryptionResponseWrapper$1.class | Bin 1268 -> 0 bytes .../core/EncryptionResponseWrapper.class | Bin 1365 -> 0 bytes .../encrypt/util/AesEncryptUtils.class | Bin 2922 -> 0 bytes .../StreamUtils$NonClosingInputStream.class | Bin 648 -> 0 bytes .../StreamUtils$NonClosingOutputStream.class | Bin 855 -> 0 bytes .../cxytiandi/encrypt/util/StreamUtils.class | Bin 4097 -> 0 bytes encrypt-springboot-example/.gitignore | 32 ++++++++++ .../target/classes/META-INF/MANIFEST.MF | 9 --- .../encrypt-springboot-example/pom.properties | 7 --- .../encrypt-springboot-example/pom.xml | 56 ------------------ .../target/classes/application.properties | 22 ------- .../encrypt_springboot_example/App.class | Bin 781 -> 0 bytes .../config/FilterConfig.class | Bin 1669 -> 0 bytes .../controller/UserController.class | Bin 2671 -> 0 bytes .../dto/UserDto.class | Bin 779 -> 0 bytes .../dto/UserXmlDto.class | Bin 1031 -> 0 bytes encrypt-springmvc-example/.gitignore | 32 ++++++++++ 24 files changed, 96 insertions(+), 100 deletions(-) create mode 100644 encrypt-core/.gitignore delete mode 100644 encrypt-core/target/classes/META-INF/MANIFEST.MF delete mode 100644 encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionConfig.class delete mode 100644 encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionFilter.class delete mode 100644 encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionReqestWrapper$1.class delete mode 100644 encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionReqestWrapper.class delete mode 100644 encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionResponseWrapper$1.class delete mode 100644 encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionResponseWrapper.class delete mode 100644 encrypt-core/target/classes/com/cxytiandi/encrypt/util/AesEncryptUtils.class delete mode 100644 encrypt-core/target/classes/com/cxytiandi/encrypt/util/StreamUtils$NonClosingInputStream.class delete mode 100644 encrypt-core/target/classes/com/cxytiandi/encrypt/util/StreamUtils$NonClosingOutputStream.class delete mode 100644 encrypt-core/target/classes/com/cxytiandi/encrypt/util/StreamUtils.class create mode 100644 encrypt-springboot-example/.gitignore delete mode 100644 encrypt-springboot-example/target/classes/META-INF/MANIFEST.MF delete mode 100644 encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.properties delete mode 100644 encrypt-springboot-example/target/classes/META-INF/maven/com.cxytiandi/encrypt-springboot-example/pom.xml delete mode 100755 encrypt-springboot-example/target/classes/application.properties delete mode 100644 encrypt-springboot-example/target/classes/com/cxytiandi/encrypt_springboot_example/App.class delete mode 100644 encrypt-springboot-example/target/classes/com/cxytiandi/encrypt_springboot_example/config/FilterConfig.class delete mode 100644 encrypt-springboot-example/target/classes/com/cxytiandi/encrypt_springboot_example/controller/UserController.class delete mode 100644 encrypt-springboot-example/target/classes/com/cxytiandi/encrypt_springboot_example/dto/UserDto.class delete mode 100644 encrypt-springboot-example/target/classes/com/cxytiandi/encrypt_springboot_example/dto/UserXmlDto.class create mode 100644 encrypt-springmvc-example/.gitignore diff --git a/.gitignore b/.gitignore index bb76b7c..8207728 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ # maven ignore target/ -bin/ *.jar *.war *.zip diff --git a/encrypt-core/.gitignore b/encrypt-core/.gitignore new file mode 100644 index 0000000..8207728 --- /dev/null +++ b/encrypt-core/.gitignore @@ -0,0 +1,32 @@ +# maven ignore +target/ +*.jar +*.war +*.zip +*.tar +*.tar.gz + +# eclipse ignore +.settings/ +.project +.classpath + +# idea ignore +.idea/ +*.ipr +*.iml +*.iws + +# temp ignore +*.log +*.cache +*.diff +*.patch +*.tmp +*.java~ +*.properties~ +*.xml~ + +# system ignore +.DS_Store +Thumbs.db diff --git a/encrypt-core/target/classes/META-INF/MANIFEST.MF b/encrypt-core/target/classes/META-INF/MANIFEST.MF deleted file mode 100644 index cda5ee7..0000000 --- a/encrypt-core/target/classes/META-INF/MANIFEST.MF +++ /dev/null @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -Built-By: user -Build-Jdk: 1.8.0_45 -Created-By: Maven Integration for Eclipse - diff --git a/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionConfig.class b/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionConfig.class deleted file mode 100644 index 44ad74feb5e254650415caee23f4668e29a29712..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3224 zcmbtVZBrXn6n>Vx0x4h$RN5*~OBtv1ExRMaeV%pIwRQ~NA=}P1t7MyQRSFHKTaK>< zozKvfekq<-Ma7*LMM8bxymvq9++$N#1ci%jibA!dL3^N~yDE29OxG3Cu4p*=FzA}> z9l0qa*)M8{U$bn>ogto?@eK{pIcHOJA%bHm97TT;L&RqDN@42K)@3ny;i6e6ZknCY za3X~m;t9M(K~!oK*;y&g8Z+*~NgQLlkrWb0^6FFy-AE>JngFcdyP2Kh%`+*a5a(4U zg(K)mKtEIkFV{(&)6ik)Y6L!tcI!ZLRHG# zeg(&I4VJDkTekfEn>Sr^k+!-qhlK>@HS{#3$*N4@CO#sOSFC5G5>h-hz>ziAEIwH> z%f3v8hDg$^E*pqr9?(Dvyjqz9V`t1|CR z1ENRsAW264Ml_>T*h4$(%|l`^6EY9$EEPFF0npxzlNxJIqbgem6 zSrj)d?#zMKv3s5?L~2^C+OD-LHmr(8Ejw%5j%&I!oT+0Ma*iw+UfH*#xhuYM) zpy=4H*mI4tbjm`ymZ%usG_Oi^d*xuCIyqjJV$0eiUY@V>!uteZl!i%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xoHCuqA#Cx`VR?%vrG^DANSLZ80qq}F8~=X85K$o$U<`+ZAm+y?fsW=YPq z8Ir+a-dL@?!Fa#u{^6{abG8%5F0NjphA%Lb9oc}$)_iJsi&S>x18M}`qn3+TXu7kB z`i0RA7+==uW}yeYsH59{I`+fh*v54WH67ILr?wM)gg=gMzQ6!&`;eyY0BJB74$?+H zLzMRu^AP9lNPVX`WnjP{Z(-m_nksfXoix|GC7r$~d{^w11hsfQA0sthQuNT-sN*k#VU9Y=1j!11txZ@-l%{R$`bc*+!nI<% z1ebRW)j!A*h%h!{;$|UE?vz?8lyNtm=sP%J~sC8Yf@tJ%jXAK Cwxe+X diff --git a/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionResponseWrapper$1.class b/encrypt-core/target/classes/com/cxytiandi/encrypt/core/EncryptionResponseWrapper$1.class deleted file mode 100644 index daf76c27e30011e4757cb3f7dd127ec73bf917d5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1268 zcmbVLT~8B16g^Y6tgMSvQ2am;v}jw9g#?WTL!yXDlPU=qn)tTePGC&gZDyxP|C28! ze#HlWfIrH3W{Xe^`q16X+_^LNo_p@SGe3WQ{{dhXDW4vaZ8+Tk16;JXNtW z>jFi3mmNdbc^EHb;ngu&`nf|W_S?nYo9m$u<)??gSwb4L zl2pZeucX;enl36n7O?2U#RVTDc;I6Rfs17ymod)957PJIioo32M0a`#Z*@$&V|I*| z;eo(}wFy)bRJTrQDX=<7NT#+Y%~|;QQu(jqox_6tWxH5-FN`9Y^0qJYzSjr6tyw^u z((|s7&$JG^{hSzV`cKa18t?_?`4jDJ`4a&<8vB@te)i{NCv?n!pX*JobE;*|P$tRC#dt1`}D^0{E zn)ubkA7z}qyBci7nBL`PcIIZDdEFmBzkCC*jt3(c!IBLdcP!kskw)2QDi*3Xa#%K+ zdlptKtTGg~Jx{95mIy-`lK9qbX{mPGI%sQ#h59>jDmpxr>a-;_Z^S(Q-Ox&klMRNP zpO}{-bME^5Sy#)aN{Q~E>0{S(^%I8W@&NR))&YM>B#H4_hJo*ea-*`xklFN)B*S>! z_2jGe$)Qwl#9@mxQ+3}Ftv#V!BPYs?K6a^=hjqt4;ZCQkUEv+MTzZb`2AVs*l6)%` zT;J;l+E*e7q@sHADv8bT-&s;}O{vdU%dk|g3>5kI{*5-YaNh5TAj#j}>Nqmclv`+l z$H@IGp9?J*rW0h|5?+(jAY89WiQB?)WEd{iYBh%a@^JOXIsa>jsSd&04Zp1%`NB10 zn7^={t7d@;7{ho06PRR}Gl~n*jZv+D0!C?m!;Ek7zJVaJh7!a2Fc1tYe{TIntC?&J zL$P1e_U`Y|F{I08bsr5o2J+2oKb|da(FL~YcBkm2=0qpzDe(-LX)Mtxl6L5Br-)Bh zmwQN6zao9mL*@+ZW8_jKIz}dBfGjyoponRbuEb8bOegb9Vg|DW$#50d=%0aZM4^D$ z>L+BsW1PTq2h|>|Gh~hG1KFeruODFs7GV@oi6RsTi+qy^*CSh2#0@%_3g+mWM~SEj zwMN{S=Lwg6M&3ZDBIsPCUpWVvk0B@WxJg}#{dwYV@?wL|_BrP)ZbucTun>h<#3kZ3 Jx#x(}^9#9cT7&=q diff --git a/encrypt-core/target/classes/com/cxytiandi/encrypt/util/AesEncryptUtils.class b/encrypt-core/target/classes/com/cxytiandi/encrypt/util/AesEncryptUtils.class deleted file mode 100644 index 582a3bce1f9c1d1caaf4fe9098d357068b589d74..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2922 zcma)8S$7j<7=ETrn>0*?rW-9gWl1-tU|T96+LQpL3zd{=t=nWWqyybh!vUB3^mr@37~1=RffHd^6K5Z9H<3Z{~ZycX{6Dd*65R$3MUP2B06` z_^}sf{g}a%VtLAkSwEh}oLHXm;#nV_^TUtly?DV3)sH4b{a6Q02xC6zLUK-Q;(mBB zFBZd#^Fn+i~!5(4Ar)r+crp?N&@3aO-;Aq?%R4_WGuNbYh=oET>$GMY+KfI{vDa#-OUc4cpK`nrpPKF%s!Qfg?YbCaCua-0| z-Lx3RO>s=mk+TbN-ITD&wpvu|+>;8APUxndR;^^3N!MydYFzl^sq#F8Ek zN4$7j#yfad#$~)Gq3gjbRRju0l<-JMnHn333{0u97+XqsyF%V^OqxmQ zni3&_x<&pX+{w6#YXa)~0?!8$YO>b3-XS68ave8h9KoY99!9@}4Xe9Z7=9?@pwK;z z6D+Df@84Pe?!Ff{WqgE>CA6+K31y8$Oq89xeC^Ki50{s(UjO^oTQWYur!qdn=U#jv z<4b(SXt9IQp@DOQ`horZYE+An(PIe9xP`BU`fW~9rE2rK!aG@Di}J|}SE7cgrgKWj9ugcpECO0H1f6s$NmoLerBNbo5U zKfzhhTqz=Rs7>f*+?uz)Kcf;hljb!Ht>C~8e)IP7(_F=GU=W>PKij+Q+;^Akeem&& z1A*&4YAAe4eAaZ`h4hncqHwLXg+BE0U3L_(9|yRr6CFrNx$zRJeq3c-UuHajLED%e zN{p+Gt5+L0lo>z51b{>Qc^LUHF>n;PZmtlkhbMgj&k|}TdKz#kkJ^B533Zdbo_km~ z+nt9T@Z3dx9uM_)1=i=WA&-V)#1_=hzL|bnP>)tLVk35=%|_7W_{LEi0i)nCo6K6$ z`#6S)p%GgU!U(F%@Nqu4_yo=>`mgKiUP53Ajm5wY$y@9|EsjzlP@Nm7G-(bt*XeD7 z6`%(zC0(;NY36%~Tr|zLk%#6Yf_C}=Yo``FnR*A4*~Qd%vp)9NsQR5KIBDM=<6+cI zzps#fhns#6|IMAEhNp}OPC^%Rk%%R$JRWybqBUDVaG)AyeE&Hd2|GJQHAfWT8~iMJy}!> z?BQ8&;k?)#TiI-25m&Q)HnT4}*cl`2ic=VXMhg0P>Qqh)r!mD{HB|d*CF&023FcNs S?RK2uTWRG;h)}x<)Bgfc-=ZS` diff --git a/encrypt-core/target/classes/com/cxytiandi/encrypt/util/StreamUtils$NonClosingInputStream.class b/encrypt-core/target/classes/com/cxytiandi/encrypt/util/StreamUtils$NonClosingInputStream.class deleted file mode 100644 index b3e55bdf960e99980d3cde16896bf3f8c79c6ece..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 648 zcmbtRO;5r=5Pe%ptFc!O{unvgVjK)IK)(KTgD+O2`#p$GqlCle3; z0DqKmT2L|JU}BT~cyFd}-p;&#yuJZA!@h+a$|iPAR2Yn=kV3T>DmC}cyZ0OsIvqJq zR8K|R8#Rvm40<~pa)wP;NZw6G10G#@gMgT#8~R?*_ac$vIjO5#5i^v#p=<|XEac6C z9)sPHl1J^pi(^h{E!Pi6jz5_y;mM(Jxb&mxSUHIjfiv@PP1pEvsa%6W6OxK8_0Ev@ z$pIP7)zWuZ=M$fgl?Y{QqDr_ICXvrCMEaJ(Lb21d6E<|@P3$o=|6`G%`qft|qO#U=knVe!_nUg;s6@WGW|5rn2@L4Ak-qP(P^C2U%;NTxJkQ}u@98@h!w&+vn;H_ zCPevI#|CN8tWls?s#T}O()A-_WW-Y@Vb6kdi7iUhi7C?0CAw?a#u}X#aT=AgV0{9f C{GEyb diff --git a/encrypt-core/target/classes/com/cxytiandi/encrypt/util/StreamUtils$NonClosingOutputStream.class b/encrypt-core/target/classes/com/cxytiandi/encrypt/util/StreamUtils$NonClosingOutputStream.class deleted file mode 100644 index 8442bff000a0167ec9635a26cc2c584176c5a855..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 855 zcmbtSOHb5L7(KTwQ|VMeKokU@h~rFRH||hOm}t^u0t*xutUBeQ*K}?t?XAME(Ty(L znHWu6_yhb=#&hR^gJEG}o8J4q&iNkwe*XIY1Hc0`0!-oBG(21na054e-1f01P}my?77VXU<*+F4STl5vkaY2J&{qhq5IeV`(#)8e>qqROZ& z8W!=KV!3uU--dvjSBCk{u3up4ZJ`W{^&9(Jacuh$T>)o*%OVdCsm7EtNsi#jQ7ZdJ z<+}87htQM_5b8E8EZEJfB9%{-ZGCp4wEK2)A!_hL%wX2XdWegd^Kn<;(SLO(usr@N zOlxFudX)2HXS{P#xxm8MdOCRh-zwpDc-$5HxZr}o=Xs9WCLF#%t=akp@tKl?X`aEr z`i_|Ql!3)z6zaG@jq!FS9IWCz?|@Mr IZXrbQ8zz;wumAu6 diff --git a/encrypt-core/target/classes/com/cxytiandi/encrypt/util/StreamUtils.class b/encrypt-core/target/classes/com/cxytiandi/encrypt/util/StreamUtils.class deleted file mode 100644 index ee7bddc67d58680c8c09c8a11c6cf6d23ac79ee2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4097 zcmb7H>r)%|6+J5ntyswz^AKRb$k@gp!15yn#~2!;;1mkN;pNJtv4vQSjF7OjN=%zJ zZQ7)HxJ@6f`*L1=(MLLywlmNvne=04`cL#@ryu*ZlZKwVyNFdRdlJvE+Wr0R@7#OO zJ@@YVA0Peo0|1ZU_Zm8oQgK7YiUt?b8r)cwyNnN66>A!NvVT*9hMZjTvSP@kpy3%j ztKyc1YOHJc622^#=QMl;UzNS*k5LgY$lq{=2MyLlLcd~U`!i1J+Z1FFq+BexoA3(&+B;w z^?P=s8HbsFc=qDOk*TZGqgO^0D5DDYMYEZ_k;oWxiF84Cg9&hPWa83H{AzSEHZu~N zQQ(>%R^UCK%A|}T1@6wSIR&0*c2QTbe>|1ZV};cPJvWnBNOPrTJey3U=MuS;Jll&N zV>!jRI>(dQ)kyNzx{*p`7E=*DlgzEJ8IgjKN=K|*W_g<*AaF9fwmy>`UN`g$xm;ph zK~v}Wjl?sFNGcm~BsI__!MRcyW?gol0cQ(_g0|vr5!1;bUGAGU63LZ`#F`znHgYSe zuNf&aM24++7$nJ85G@~!vy2b+Da!f*CkVe(4%TwDLDAxlg#|S zv%`f{dQs02!b<`0PC>I}RLahjxhZA~g{37ibInH;R4$O#ylkrYu8Qwb-c+`VCs zlW3ju!$rUno}~D}@>>cf*u6<_hyW@vwT3 zlhPC@e3OD`wvaJYMEEFaPq8>u@X1euH8$2Yrl5j7l%vQL-n;e8B1@ZJNv*Bvyz`r6 z&t#(}u@#HCgow4Vypt}5rs=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UKj84ux7R0z3zIJu)d|A=U-G;u;pDI zu;kTFQGudykyX))pE_xvQrZ~Ean_=nbr3;6VmT?+tk)*RMT`#Aa3QLJWcQbo!kwFHqp@U4SGX&?xA-Zjd5F>HBFm181!zU zxu%78G;6MDUS zQJ#~$ULp}s;we`0D(kh3S={8xbIkH3T)`{cxs5NHWKNN+If`9K@=M-DTJPGl%Gwpo zlOMTzigzA*eVym$smI57`f1+zOwU5PW>Ou5_d}fZ{0~(g()}SCl$QS@;3{GLDy~_q z<2C+@au1oTjk^ZjLt(0;ERhBkKo)4C^>gJ#>Nc)dZ-EA*L0Jyto7vJNdD zvUBlr=tyMzP~!}fOhwCejJ%r?kqKoALla#n2TDRrV1dVESRSFN{PS<4E&eBjws2TR z4qsusdie|7;^0YQ(LQj72V}K!8|`t9=p$n8a+tqhhAJ~%# - 4.0.0 - - com.cxytiandi - encrypt-springboot-example - 1.1-SNAPSHOT - jar - - encrypt-springboot-example - http://maven.apache.org - - - UTF-8 - - - - org.springframework.boot - spring-boot-starter-parent - 2.0.6.RELEASE - - - - - - org.springframework.boot - spring-boot-starter-web - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - - - com.cxytiandi - monkey-api-encrypt-core - 1.1-SNAPSHOT - - - org.springframework.boot - spring-boot-starter-freemarker - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - - diff --git a/encrypt-springboot-example/target/classes/application.properties b/encrypt-springboot-example/target/classes/application.properties deleted file mode 100755 index 095e4d5..0000000 --- a/encrypt-springboot-example/target/classes/application.properties +++ /dev/null @@ -1,22 +0,0 @@ -logging.level.com.cxytiandi.encrypt=DEBUG - -spring.freemarker.cache=true -spring.freemarker.charset=UTF-8 -spring.freemarker.check-template-location=true -spring.freemarker.content-type=text/html -spring.freemarker.expose-request-attributes=true -spring.freemarker.expose-session-attributes=true -spring.freemarker.request-context-attribute=request -spring.freemarker.suffix=.html - -spring.encrypt.key=abcdef0123456789 -spring.encrypt.requestDecyptUriList[0]=/save -spring.encrypt.requestDecyptUriList[1]=/decryptEntityXml - -spring.encrypt.responseEncryptUriList[0]=/encryptStr -spring.encrypt.responseEncryptUriList[1]=/encryptEntity -spring.encrypt.responseEncryptUriList[2]=/save -spring.encrypt.responseEncryptUriList[3]=/encryptEntityXml -spring.encrypt.responseEncryptUriList[4]=/decryptEntityXml -#spring.encrypt.urlPatterns[0]=/user/* -#spring.encrypt.urlPatterns[1]=/save/* \ No newline at end of file diff --git a/encrypt-springboot-example/target/classes/com/cxytiandi/encrypt_springboot_example/App.class b/encrypt-springboot-example/target/classes/com/cxytiandi/encrypt_springboot_example/App.class deleted file mode 100644 index 3b205372239731480dd7a029b34b8d67730f4858..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 781 zcmb7?O>fgc5Qg7P(>gVwEh%j&9|vw}gu3Fw#i$ZQ?a68-g2I7AwRX2=i@j^D*O2}! zP9P5a0Dcr=)`^-NeCcJzJ0I`PGv2@de*XdR8ZQEL7+$5O;OXqvDWR_vmpZk#rMs+3 zt8|ta<1Xb)6lE^?yRr<>W!Sk9-vrNv&iF-gBU8t)@m6W&P8imPM^lFG*j&jFYuM~# z9UBbWvC{IqE)r=!iX@i|gV>}Zp9-t|c@gZoFREfVj_)&5ME4a!X@>pb=Xg2W#Cd|~ zXd2=Xb^{C;M#g4*PIhfYA-@~@m3u}$X>f@!SE+Ey=sq4}k9cfN!pU$&cbto=irQ|9 z+vHQDot!y7Hu_p+we`3w_fXiUJ%q3s!SA*xGlUaU+f<$@zq=mwAA3-S!wn>+n3x8gDtPgA9=o(Y9-!SNHLszCw2t)MbPBy^>@#=$o61YD#(N|V?DAC` zMTTR2*%AR8*BOrY50a2=%o-X!Z6BhM#SI5Hjo0beYqT8(k?bYA=hwn5hSFCkC4+g4 zTDbGM6;2u~g9ZF(+J%HRn;YB#gSA10H7@TtSi*gVQDT-r63ZlmyPs&AENm<@4DlIb zx#Hj0}}P*kz#(7k&VZsgae883C!b(gI|meEs9}{8qA=V9X!Jt zgH31asv#B4hujl0CPtD8W18m+T7mN8s3V4>*@OLie4U}Mxdx8o7=4}O0j=NAj#7*h1ah+XYK&F` z^e=%L2km`iYkN3VE@UUVm@1_I!r9tz_I#z5%6?b*0~fovTCkJDf;qfasin>JNS0S> zR{zc1KIRGL_Os$X7HWk(-0fnqm`dz^s&w(7n0?g6&&5<1Pm8~i;~|*9XX5WTY@DJ% yCvXXqc#J8m<1}954Bp}_0-QsH^D(&#NzgrVHd^%ZIgwn)6}-SkoUKZX{_=nGpv!mw diff --git a/encrypt-springboot-example/target/classes/com/cxytiandi/encrypt_springboot_example/controller/UserController.class b/encrypt-springboot-example/target/classes/com/cxytiandi/encrypt_springboot_example/controller/UserController.class deleted file mode 100644 index f83f08bfde924d03a16c127052d7be6d34c758cc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2671 zcmbtVTU!%X6kP`b6XGZ|7_2v1FVJ9wsTC9(YbzHmHe3owq1NIgImEG(nRMm^$sg!L zU;EIve)gqLRjUud*022m{T=ePzoK9FnHiFdHY4J`;WA8Q-W+L~Ar?fqARLCn$$?BAH*HbObmr)M*%C&PFBz^u zIIdfkEp%bn7Qq!p%!vTa>A%M{^( zZHCEN6bT|>>-$GrPruuG{Nq2r{_^U@bB2Qf!b!p)Dh#6pa@V2fh3#c$Lf90@Nb`#U ze3{)wz>|LN>E5Ajls*Op$0_jrV2I%uI^?HU#XESHq0QxDDoeg=gu%n;2CiR8{)NnN#4%nX;BhuTcYVU8lMzE0My>MNR%2zu%yUPkc2va`d`Ma-_*$U$Fcrg9 zTvPB-*rivHDn7<1Bm}R5X4j+;rka#(3?mqmouxmD2?j>88^H|~H}NU8A}T~~k?sbY ziD-we098xf-e~^@44=MR57f` z(qBPu6kk))c9!|_bVmMvmf_0YYp)i1SDt%Mmfxyqn_+q%wH(-MA}mTXJ$-Ju$Xy9{ zRDN#JL$Y9(ogBYm$cL*t{2~rX5m4veLsnc-e^Apn1*$Q6rGa*u(Q8Rxg;pAkjK;Qe zn}|N6Neg1ZA)pHfXs-GPXgo+O>gDL9Q(ZJaM60*x7rz7MqT4e#NNZ`ZHGcRv8XCHto02e&QvLt!&~%CKajTWGa5DiZiLYlQ<%D=s2P{ zK}b&$o?g#kkAFFE7^VN-L()SzfOAC3b|k41IYmPinJQ)*Fva{!ID`HMEPVkMGFQX02pOit(nD^SXzsJRh%Y>L zmtUu1g{ZjWQSntOez%I%2Dd&HDWc*$g*!-83^lkoBNw>eLCL*< ul4PBde3%kmr=$vA&y>%~MPg;R0amicN|IQSuv)N2e6*n8@ggOAANU{G4be#e diff --git a/encrypt-springboot-example/target/classes/com/cxytiandi/encrypt_springboot_example/dto/UserDto.class b/encrypt-springboot-example/target/classes/com/cxytiandi/encrypt_springboot_example/dto/UserDto.class deleted file mode 100644 index 1a93f0330c79384155d37339ee30ed59c47e82e0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 779 zcmbV}T}uK%6o%jNYjfMu%(U;1J2hwtqMM?dA`rwbtZrjm2OH5{S*OVV)I~uObkPs! zM@45wK~lSkg)?)`zUQ3hoca3x_yll>T?-M0BQNN<-cw&m?l+_>d@t;G)m^U}O21hT z0(B>zc&FPIZbJp`O;3auDzFe^NVoVSciY@=x>xm<@DxKtHW*l$A?EXrV8~R)nwruT zPZ$!X(wFLtAzCQjlJq=i2pdr>I7q@~NL8dSst=vI2(Nj)ZOQ~5Z{PAzYJU`rse9RD zIIjF>0K$kjg(?#+QIwNlSaA?Xg5telJXR=cJd0#iGfcKnoE}GKZaA>Wg zN?pvZ1rMPoE~TEz87=cb?+ANTC`#`Vp^rGsjjGZar$4k9vh(D*bTS<+y~BAmvPH59 z6O1B7cV{R-8cXESD`1)I@8maRpC^*-naMfiN6BY~jarp92FQ+E+Y|>Di8Ey?@PEsM6NpU72jAapLYw*quo7pS)18 z2wwOD{88eW-OykYZxd;cW!Z(!(U|)r2Qr~ zLmAu2V}^2Q0uk}d_(n1 zTJkcjt|X{vomM{!z!fZ$#jt`^TK`P`inUL4=wX&zTbR6otJCD&l%Aw^HczoOldg~- zBvl|GC%>B7#i_hQ%Q|M*#MT0k#^-Y&>kC1y5|QG=w|90pl^wRsaA1 diff --git a/encrypt-springmvc-example/.gitignore b/encrypt-springmvc-example/.gitignore new file mode 100644 index 0000000..8207728 --- /dev/null +++ b/encrypt-springmvc-example/.gitignore @@ -0,0 +1,32 @@ +# maven ignore +target/ +*.jar +*.war +*.zip +*.tar +*.tar.gz + +# eclipse ignore +.settings/ +.project +.classpath + +# idea ignore +.idea/ +*.ipr +*.iml +*.iws + +# temp ignore +*.log +*.cache +*.diff +*.patch +*.tmp +*.java~ +*.properties~ +*.xml~ + +# system ignore +.DS_Store +Thumbs.db