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 */