From 782b5e075bd34bcdc8b10e9a318df6e5fae87f53 Mon Sep 17 00:00:00 2001 From: zlt2000 Date: Tue, 14 Jul 2020 00:17:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dredis-cluster=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E5=88=A0=E9=99=A4token=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/store/CustomRedisTokenStore.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/store/CustomRedisTokenStore.java b/zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/store/CustomRedisTokenStore.java index 43193a3..ec1eba1 100644 --- a/zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/store/CustomRedisTokenStore.java +++ b/zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/store/CustomRedisTokenStore.java @@ -360,16 +360,14 @@ public class CustomRedisTokenStore implements TokenStore { byte[] accessToRefreshKey = serializeKey(ACCESS_TO_REFRESH + tokenValue); RedisConnection conn = getConnection(); try { + byte[] access = conn.get(accessKey); + byte[] auth = conn.get(authKey); conn.openPipeline(); - conn.get(accessKey); - conn.get(authKey); conn.del(accessKey); conn.del(accessToRefreshKey); // Don't remove the refresh token - it's up to the caller to do that conn.del(authKey); - List results = conn.closePipeline(); - byte[] access = (byte[]) results.get(0); - byte[] auth = (byte[]) results.get(1); + conn.closePipeline(); OAuth2Authentication authentication = deserializeAuthentication(auth); if (authentication != null) { @@ -471,20 +469,17 @@ public class CustomRedisTokenStore implements TokenStore { private void removeAccessTokenUsingRefreshToken(String refreshToken) { byte[] key = serializeKey(REFRESH_TO_ACCESS + refreshToken); - List results = null; RedisConnection conn = getConnection(); + byte[] bytes = null; try { - conn.openPipeline(); - conn.get(key); + bytes = conn.get(key); conn.del(key); - results = conn.closePipeline(); } finally { conn.close(); } - if (results == null) { + if (bytes == null) { return; } - byte[] bytes = (byte[]) results.get(0); String accessToken = deserializeString(bytes); if (accessToken != null) { removeAccessToken(accessToken); -- GitLab