From bf74511a828e30cf5b3cef44bc8348ec655782c1 Mon Sep 17 00:00:00 2001 From: yangy Date: Sun, 7 Jun 2020 10:06:00 +0800 Subject: [PATCH] simplify code --- .../alibaba/nacos/console/security/nacos/JwtTokenManager.java | 2 +- .../java/com/alibaba/nacos/console/utils/JwtTokenUtils.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/console/src/main/java/com/alibaba/nacos/console/security/nacos/JwtTokenManager.java b/console/src/main/java/com/alibaba/nacos/console/security/nacos/JwtTokenManager.java index 0ef8fce1f..a07738f44 100644 --- a/console/src/main/java/com/alibaba/nacos/console/security/nacos/JwtTokenManager.java +++ b/console/src/main/java/com/alibaba/nacos/console/security/nacos/JwtTokenManager.java @@ -57,7 +57,7 @@ public class JwtTokenManager { public String createToken(String userName) { - long now = (new Date()).getTime(); + long now = System.currentTimeMillis(); Date validity; validity = new Date(now + authConfigs.getTokenValidityInSeconds() * 1000L); diff --git a/console/src/main/java/com/alibaba/nacos/console/utils/JwtTokenUtils.java b/console/src/main/java/com/alibaba/nacos/console/utils/JwtTokenUtils.java index 55b32401e..967a45fd9 100644 --- a/console/src/main/java/com/alibaba/nacos/console/utils/JwtTokenUtils.java +++ b/console/src/main/java/com/alibaba/nacos/console/utils/JwtTokenUtils.java @@ -104,7 +104,7 @@ public class JwtTokenUtils { /** * Current time */ - long now = (new Date()).getTime(); + long now = System.currentTimeMillis(); /** * Validity date */