github
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
<artifactId>security-api-demo</artifactId>
|
||||
<groupId>org.example</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>gateway</artifactId>
|
||||
@@ -41,7 +42,28 @@
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
<version>1.9.7</version> <!-- 版本号根据你的需求进行调整 -->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.11</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/commons-collections/commons-collections -->
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<version>3.2.2</version>
|
||||
</dependency>
|
||||
<!--json-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.73</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.15</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.demo.gateway.filter;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.nacos.common.utils.Md5Utils;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import com.demo.gateway.config.FilterUtils;
|
||||
import com.demo.gateway.pojo.MyCachedBodyOutputMessage;
|
||||
import com.demo.gateway.utils.AESUtil;
|
||||
@@ -127,7 +127,7 @@ public class RequestDecryptionGlobalFilter implements GlobalFilter, Ordered {
|
||||
|
||||
public void checkSign(String sign, Long dateTimestamp, String requestId, Map<String, Object> paramMap) {
|
||||
String str = JSON.toJSONString(paramMap) + requestId + dateTimestamp;
|
||||
String tempSign = Md5Utils.getMD5(str.getBytes());
|
||||
String tempSign = DigestUtils.md5Hex(str);
|
||||
if (!tempSign.equals(sign)) {
|
||||
throw new IllegalArgumentException(SIGN_ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
@@ -79,6 +79,23 @@
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>3.18.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.11</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/commons-collections/commons-collections -->
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<version>3.2.2</version>
|
||||
</dependency>
|
||||
<!--json-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.73</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user