xiaoyong931011
2020-07-10 343a75711545b39bf7cbaddd48c52edcd6560410
src/main/java/com/xcong/excoin/configurations/security/TokenFilter.java
@@ -60,9 +60,11 @@
                SecurityContextHolder.getContext().setAuthentication(authentication);
                redisUtils.expire(redisKey, 300000);
            } else {
                log.info("token无法查询:{}", token);
                SecurityContextHolder.clearContext();
            }
        } else {
            log.info("token为空:{}", request.getRequestURI());
            SecurityContextHolder.clearContext();
        }
@@ -89,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;