From c5840d89d3cfbad60f4597e810b456b1b3f7e010 Mon Sep 17 00:00:00 2001 From: guoyonggang Date: Wed, 27 Oct 2021 11:26:20 +0800 Subject: [PATCH 1/3] fixed token expire --- .../main/java/com/baidu/hugegraph/auth/StandardAuthManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java index 2a3f7574a5..0b62d38687 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java @@ -667,7 +667,7 @@ public String loginUser(String username, String password) username, AuthConstant.TOKEN_USER_ID, user.id.asString()); - String token = this.tokenGenerator.create(payload, this.tokenExpire); + String token = this.tokenGenerator.create(payload, this.tokenExpire * 1000); this.tokenCache.update(IdGenerator.of(token), username); return token; From 7bec59950047d92547185449d61746a583b26817 Mon Sep 17 00:00:00 2001 From: guoyonggang Date: Wed, 27 Oct 2021 11:27:17 +0800 Subject: [PATCH 2/3] format source code --- .../java/com/baidu/hugegraph/auth/StandardAuthManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java index 0b62d38687..948c364134 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java @@ -667,7 +667,8 @@ public String loginUser(String username, String password) username, AuthConstant.TOKEN_USER_ID, user.id.asString()); - String token = this.tokenGenerator.create(payload, this.tokenExpire * 1000); + String token = this.tokenGenerator.create(payload, + this.tokenExpire * 1000); this.tokenCache.update(IdGenerator.of(token), username); return token; From e31d3efd50d0aec3fa3766ccc12936832fe8d4b9 Mon Sep 17 00:00:00 2001 From: guoyonggang Date: Wed, 27 Oct 2021 14:02:55 +0800 Subject: [PATCH 3/3] fixed token expire --- .../java/com/baidu/hugegraph/auth/StandardAuthManager.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java index 948c364134..a8ef386e39 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java @@ -87,7 +87,7 @@ public StandardAuthManager(HugeGraphParams graph) { HugeConfig config = graph.configuration(); long expired = config.get(AuthOptions.AUTH_CACHE_EXPIRE); long capacity = config.get(AuthOptions.AUTH_CACHE_CAPACITY); - this.tokenExpire = config.get(AuthOptions.AUTH_TOKEN_EXPIRE); + this.tokenExpire = config.get(AuthOptions.AUTH_TOKEN_EXPIRE) * 1000; this.graph = graph; this.eventListener = this.listenChanges(); @@ -667,8 +667,7 @@ public String loginUser(String username, String password) username, AuthConstant.TOKEN_USER_ID, user.id.asString()); - String token = this.tokenGenerator.create(payload, - this.tokenExpire * 1000); + String token = this.tokenGenerator.create(payload, this.tokenExpire); this.tokenCache.update(IdGenerator.of(token), username); return token;