| | |
| | | redisKey = AppContants.APP_LOGIN_PREFIX + token; |
| | | } |
| | | |
| | | log.info("---->{}", redisKey); |
| | | String loginStr = (String) redisUtils.get(redisKey); |
| | | 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(); |
| | | } |
| | | |