fix: Gateway Token验证修复

1. Gateway Redis database 改为 0(与业务服务一致)
2. TokenInfo 添加 @JsonIgnoreProperties(ignoreUnknown = true)
3. TokenInfo.isExpired() 添加 @JsonIgnore 避免序列化
4. isExpired() 方法增加 null 检查
This commit is contained in:
zhangjf 2026-02-20 18:52:54 +08:00
parent 52c926dcd6
commit 44e7efdfc0
18 changed files with 35 additions and 30 deletions

View File

@ -1,4 +1,4 @@
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice. #NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
#Fri Feb 20 18:33:58 CST 2026 #Fri Feb 20 18:51:03 CST 2026
fund-common-0.0.1-SNAPSHOT.jar>= fund-common-0.0.1-SNAPSHOT.jar>=
fund-common-0.0.1-SNAPSHOT.pom>= fund-common-0.0.1-SNAPSHOT.pom>=

View File

@ -3,7 +3,7 @@
<groupId>com.fundplatform</groupId> <groupId>com.fundplatform</groupId>
<artifactId>fund-common</artifactId> <artifactId>fund-common</artifactId>
<versioning> <versioning>
<lastUpdated>20260220103348</lastUpdated> <lastUpdated>20260220105100</lastUpdated>
<snapshot> <snapshot>
<localCopy>true</localCopy> <localCopy>true</localCopy>
</snapshot> </snapshot>
@ -11,12 +11,12 @@
<snapshotVersion> <snapshotVersion>
<extension>pom</extension> <extension>pom</extension>
<value>0.0.1-SNAPSHOT</value> <value>0.0.1-SNAPSHOT</value>
<updated>20260220103348</updated> <updated>20260220105100</updated>
</snapshotVersion> </snapshotVersion>
<snapshotVersion> <snapshotVersion>
<extension>jar</extension> <extension>jar</extension>
<value>0.0.1-SNAPSHOT</value> <value>0.0.1-SNAPSHOT</value>
<updated>20260220103348</updated> <updated>20260220105100</updated>
</snapshotVersion> </snapshotVersion>
</snapshotVersions> </snapshotVersions>
</versioning> </versioning>

View File

@ -6,6 +6,6 @@
<versions> <versions>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
</versions> </versions>
<lastUpdated>20260220103348</lastUpdated> <lastUpdated>20260220105100</lastUpdated>
</versioning> </versioning>
</metadata> </metadata>

View File

@ -1,3 +1,3 @@
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice. #NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
#Fri Feb 20 18:33:50 CST 2026 #Fri Feb 20 18:51:01 CST 2026
fundplatform-0.0.1-SNAPSHOT.pom>= fundplatform-0.0.1-SNAPSHOT.pom>=

View File

@ -3,7 +3,7 @@
<groupId>com.fundplatform</groupId> <groupId>com.fundplatform</groupId>
<artifactId>fundplatform</artifactId> <artifactId>fundplatform</artifactId>
<versioning> <versioning>
<lastUpdated>20260220103348</lastUpdated> <lastUpdated>20260220105100</lastUpdated>
<snapshot> <snapshot>
<localCopy>true</localCopy> <localCopy>true</localCopy>
</snapshot> </snapshot>
@ -11,7 +11,7 @@
<snapshotVersion> <snapshotVersion>
<extension>pom</extension> <extension>pom</extension>
<value>0.0.1-SNAPSHOT</value> <value>0.0.1-SNAPSHOT</value>
<updated>20260220103348</updated> <updated>20260220105100</updated>
</snapshotVersion> </snapshotVersion>
</snapshotVersions> </snapshotVersions>
</versioning> </versioning>

View File

@ -6,6 +6,6 @@
<versions> <versions>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
</versions> </versions>
<lastUpdated>20260220103348</lastUpdated> <lastUpdated>20260220105100</lastUpdated>
</versioning> </versioning>
</metadata> </metadata>

View File

@ -1,2 +1,2 @@
#Fri Feb 20 18:40:08 CST 2026 #Fri Feb 20 18:45:42 CST 2026
central|https\://repo1.maven.org/maven2|null=1771584008125 central|https\://repo1.maven.org/maven2|null=1771584342966

View File

@ -1,2 +1,2 @@
#Fri Feb 20 18:40:08 CST 2026 #Fri Feb 20 18:45:42 CST 2026
central|https\://repo1.maven.org/maven2|null=1771584008166 central|https\://repo1.maven.org/maven2|null=1771584342984

View File

@ -1,2 +1,2 @@
#Fri Feb 20 18:40:08 CST 2026 #Fri Feb 20 18:45:43 CST 2026
central|https\://repo1.maven.org/maven2|null=1771584008178 central|https\://repo1.maven.org/maven2|null=1771584343003

View File

@ -1,2 +1,2 @@
#Fri Feb 20 18:40:08 CST 2026 #Fri Feb 20 18:45:43 CST 2026
central|https\://repo1.maven.org/maven2|null=1771584008176 central|https\://repo1.maven.org/maven2|null=1771584343001

View File

@ -1,2 +1,2 @@
#Fri Feb 20 18:40:08 CST 2026 #Fri Feb 20 18:45:42 CST 2026
central|https\://repo1.maven.org/maven2|null=1771584008171 central|https\://repo1.maven.org/maven2|null=1771584342991

View File

@ -1,2 +1,2 @@
#Fri Feb 20 18:40:08 CST 2026 #Fri Feb 20 18:45:42 CST 2026
central|https\://repo1.maven.org/maven2|null=1771584008165 central|https\://repo1.maven.org/maven2|null=1771584342979

View File

@ -1,2 +1,2 @@
#Fri Feb 20 18:40:08 CST 2026 #Fri Feb 20 18:45:43 CST 2026
central|https\://repo1.maven.org/maven2|null=1771584008180 central|https\://repo1.maven.org/maven2|null=1771584343012

View File

@ -1,2 +1,2 @@
#Fri Feb 20 18:40:08 CST 2026 #Fri Feb 20 18:45:42 CST 2026
central|https\://repo1.maven.org/maven2|null=1771584008169 central|https\://repo1.maven.org/maven2|null=1771584342989

View File

@ -1,2 +1,2 @@
#Fri Feb 20 18:40:08 CST 2026 #Fri Feb 20 18:45:42 CST 2026
central|https\://repo1.maven.org/maven2|null=1771584008173 central|https\://repo1.maven.org/maven2|null=1771584342997

View File

@ -1,11 +1,15 @@
package com.fundplatform.common.auth; package com.fundplatform.common.auth;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.Serializable; import java.io.Serializable;
/** /**
* Token信息实体 * Token信息实体
* 存储在Redis中的用户会话信息 * 存储在Redis中的用户会话信息
*/ */
@JsonIgnoreProperties(ignoreUnknown = true)
public class TokenInfo implements Serializable { public class TokenInfo implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -89,7 +93,8 @@ public class TokenInfo implements Serializable {
/** /**
* 检查Token是否过期 * 检查Token是否过期
*/ */
@JsonIgnore
public boolean isExpired() { public boolean isExpired() {
return System.currentTimeMillis() > expireTime; return expireTime != null && System.currentTimeMillis() > expireTime;
} }
} }

View File

@ -5,13 +5,13 @@ spring:
application: application:
name: fund-gateway name: fund-gateway
# Redis配置(用于限流) # Redis配置(用于限流和Token验证)
data: data:
redis: redis:
host: localhost host: localhost
port: 6379 port: 6379
password: zjf@123456 password: zjf@123456
database: 1 database: 0
cloud: cloud:
compatibility-verifier: compatibility-verifier: