From 5e94dc275705f89d02f9a6e82925afcaf7b046b3 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Fri, 10 Jul 2020 12:53:21 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/chonggaoxiao/new_excoin

---
 src/main/java/com/xcong/excoin/configurations/security/TokenFilter.java |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/configurations/security/TokenFilter.java b/src/main/java/com/xcong/excoin/configurations/security/TokenFilter.java
index 8b98b0b..1c3dede 100644
--- a/src/main/java/com/xcong/excoin/configurations/security/TokenFilter.java
+++ b/src/main/java/com/xcong/excoin/configurations/security/TokenFilter.java
@@ -9,6 +9,7 @@
 import com.xcong.excoin.common.system.bean.LoginUserBean;
 import com.xcong.excoin.configurations.properties.ApplicationProperties;
 import com.xcong.excoin.configurations.properties.SecurityProperties;
+import com.xcong.excoin.modules.member.entity.MemberEntity;
 import com.xcong.excoin.utils.RedisUtils;
 import com.xcong.excoin.utils.SpringContextHolder;
 import lombok.extern.slf4j.Slf4j;
@@ -54,14 +55,16 @@
 
             String loginStr = (String) redisUtils.get(redisKey);
             if (StrUtil.isNotBlank(loginStr)) {
-                LoginUserBean loginUser = JSONObject.parseObject(loginStr, LoginUserBean.class);
-                Authentication authentication = new UsernamePasswordAuthenticationToken(loginUser.getMemberEntity(), token, new ArrayList<>());
+                MemberEntity loginUser = JSONObject.parseObject(loginStr, MemberEntity.class);
+                Authentication authentication = new UsernamePasswordAuthenticationToken(loginUser, token, new ArrayList<>());
                 SecurityContextHolder.getContext().setAuthentication(authentication);
                 redisUtils.expire(redisKey, 300000);
             } else {
+                log.info("token无法查询:{}", token);
                 SecurityContextHolder.clearContext();
             }
         } else {
+            log.info("token为空:{}", request.getRequestURI());
             SecurityContextHolder.clearContext();
         }
 
@@ -88,11 +91,15 @@
                 String rsaToken = bearerToken.replace(AppContants.TOKEN_START_WITH, "");
                 RSA rsa = new RSA(securityProperties.getPrivateKey(), null);
                 String[] tokens = StrUtil.split(rsa.decryptStr(rsaToken, KeyType.PrivateKey), "_");
+
                 if (verifyTokenExpired(Long.parseLong(tokens[1]))) {
                     return tokens[0];
                 }
+                log.info("前面token为{}", tokens[0]);
+                log.info("时间为:{}, 当前时间为:{}", tokens[1], System.currentTimeMillis());
                 return null;
             }
+            log.info("bearerToken---->{}", bearerToken);
         } catch (Exception e) {
             log.error("#解析token异常#", e);
             return null;

--
Gitblit v1.9.1