Helius
2020-07-10 282f8e760197f5b99ad7020c30c499eda123def3
src/main/java/com/xcong/excoin/configurations/security/TokenFilter.java
@@ -53,18 +53,19 @@
                redisKey = AppContants.APP_LOGIN_PREFIX + token;
            }
            log.info("---->{}", redisKey);
            String loginStr = (String) redisUtils.get(redisKey);
            log.info("---->{}", loginStr);
            log.info("当前登陆用户为:{}", loginStr);
            if (StrUtil.isNotBlank(loginStr)) {
                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();
        }