From f1f506172a3edff8d31e4db77b8940f115660919 Mon Sep 17 00:00:00 2001
From: songhuangfeng123 <shf18767906695@163.com>
Date: 星期二, 20 九月 2022 16:25:43 +0800
Subject: [PATCH] fix

---
 safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/TokenAuthenticationFilter.java |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/TokenAuthenticationFilter.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/TokenAuthenticationFilter.java
index 46b5c97..1316c2a 100644
--- a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/TokenAuthenticationFilter.java
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/TokenAuthenticationFilter.java
@@ -4,15 +4,15 @@
 import com.alibaba.fastjson.JSONObject;
 import com.gkhy.safePlatform.account.rpc.apimodel.AccountAuthService;
 import com.gkhy.safePlatform.account.rpc.apimodel.AccountAuthService;
-import com.gkhy.safePlatform.commons.co.CacheAuthority;
-import com.gkhy.safePlatform.commons.co.CacheUser;
+import com.gkhy.safePlatform.commons.co.ContextCacheAuthority;
+import com.gkhy.safePlatform.commons.co.ContextCacheUser;
 import com.gkhy.safePlatform.commons.enums.RedisKeyEnum;
 import com.gkhy.safePlatform.commons.enums.ResultCodes;
 import com.gkhy.safePlatform.commons.exception.BusinessException;
 import com.gkhy.safePlatform.commons.utils.RPCUtils;
-import com.gkhy.safePlatform.commons.utils.RedisUtils;
 import com.gkhy.safePlatform.commons.utils.StringUtils;
 import com.gkhy.safePlatform.commons.vo.ResultVO;
+import com.gkhy.safePlatform.config.redis.RedisUtils;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -86,9 +86,9 @@
                 throw new BusinessException(ResultCodes.CLIENT_CREDENTIALS_TOKEN_INVALID);
             }else{
                 Long userId = Long.valueOf(loginUserId);
-                CacheUser cacheUser = JSONObject.parseObject(o.toString(), CacheUser.class);
-                assert userId.equals(cacheUser.getUserId());
-                if ( !authToken.equals(cacheUser.getAccessToken())) {
+                ContextCacheUser contextCacheUser = JSONObject.parseObject(o.toString(), ContextCacheUser.class);
+                assert userId.equals(contextCacheUser.getUid());
+                if ( !authToken.equals(contextCacheUser.getAccessToken())) {
                     throw new BusinessException(ResultCodes.CLIENT_CREDENTIALS_TOKEN_INVALID);
                 }
 
@@ -99,8 +99,8 @@
                 // 4.redis中是否存在
                 if (oo != null) {
                     // 5.存在
-                    List<CacheAuthority> cacheAuthorities = JSONArray.parseArray(oo.toString(), CacheAuthority.class);
-                    for (CacheAuthority cacheAuthority: cacheAuthorities) {
+                    List<ContextCacheAuthority> cacheAuthorities = JSONArray.parseArray(oo.toString(), ContextCacheAuthority.class);
+                    for (ContextCacheAuthority cacheAuthority: cacheAuthorities) {
                         authorities.add(new SimpleGrantedAuthority(cacheAuthority.getAuthority()));
                     }
                 }else {
@@ -146,7 +146,7 @@
                 }
 
                 // security对象中存入登陆者信息
-                return new UsernamePasswordAuthenticationToken(userId,authToken,authorities);
+                return new UsernamePasswordAuthenticationToken(contextCacheUser,authToken,authorities);
 
             }
 

--
Gitblit v1.9.2