提交 3fe3d7f8 编写于 作者: M MaxKey

Merge branch 'master' of https://gitee.com/dromara/MaxKey

...@@ -148,4 +148,9 @@ public class RedisConnection { ...@@ -148,4 +148,9 @@ public class RedisConnection {
this.conn = conn; this.conn = conn;
} }
public Pipeline getPipeline() {
return pipeline;
}
} }
...@@ -35,6 +35,7 @@ import org.maxkey.util.ObjectTransformer; ...@@ -35,6 +35,7 @@ import org.maxkey.util.ObjectTransformer;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.Date; import java.util.Date;
/** /**
...@@ -216,14 +217,15 @@ public class RedisTokenStore implements TokenStore { ...@@ -216,14 +217,15 @@ public class RedisTokenStore implements TokenStore {
RedisConnection conn = getConnection(); RedisConnection conn = getConnection();
try { try {
conn.openPipeline(); conn.openPipeline();
conn.delete(accessKey); conn.getPipeline().get(accessKey);
conn.delete(accessToRefreshKey); conn.getPipeline().get(authKey);
// Don't remove the refresh token - it's up to the caller to do that conn.getPipeline().del(accessKey);
conn.delete(authKey); conn.getPipeline().del(accessToRefreshKey);
//Don't remove the refresh token - it's up to the caller to do that
conn.getPipeline().del(authKey);
List<Object> results = conn.closePipeline(); List<Object> results = conn.closePipeline();
String access = (String) results.get(0); String access = (String) results.get(0);
String auth = (String) results.get(1); String auth = (String) results.get(1);
OAuth2Authentication authentication = ObjectTransformer.deserialize(auth); OAuth2Authentication authentication = ObjectTransformer.deserialize(auth);
if (authentication != null) { if (authentication != null) {
String key = authenticationKeyGenerator.extractKey(authentication); String key = authenticationKeyGenerator.extractKey(authentication);
...@@ -251,6 +253,7 @@ public class RedisTokenStore implements TokenStore { ...@@ -251,6 +253,7 @@ public class RedisTokenStore implements TokenStore {
conn.openPipeline(); conn.openPipeline();
conn.setObject(refreshKey, refreshToken); conn.setObject(refreshKey, refreshToken);
conn.setObject(refreshAuthKey, authentication); conn.setObject(refreshAuthKey, authentication);
if (refreshToken instanceof ExpiringOAuth2RefreshToken) { if (refreshToken instanceof ExpiringOAuth2RefreshToken) {
ExpiringOAuth2RefreshToken expiringRefreshToken = (ExpiringOAuth2RefreshToken) refreshToken; ExpiringOAuth2RefreshToken expiringRefreshToken = (ExpiringOAuth2RefreshToken) refreshToken;
Date expiration = expiringRefreshToken.getExpiration(); Date expiration = expiringRefreshToken.getExpiration();
...@@ -314,8 +317,8 @@ public class RedisTokenStore implements TokenStore { ...@@ -314,8 +317,8 @@ public class RedisTokenStore implements TokenStore {
RedisConnection conn = getConnection(); RedisConnection conn = getConnection();
try { try {
conn.openPipeline(); conn.openPipeline();
conn.get(key); conn.getPipeline().get(key);
conn.delete(key); conn.getPipeline().del(key);
results = conn.closePipeline(); results = conn.closePipeline();
} finally { } finally {
conn.close(); conn.close();
...@@ -323,11 +326,12 @@ public class RedisTokenStore implements TokenStore { ...@@ -323,11 +326,12 @@ public class RedisTokenStore implements TokenStore {
if (results == null) { if (results == null) {
return; return;
} }
String bytes = (String) results.get(0); String accessToken = (String) results.get(0);
String accessToken = ObjectTransformer.deserialize(bytes); //String accessToken = ObjectTransformer.deserialize(bytes);
if (accessToken != null) { if (accessToken != null) {
removeAccessToken(accessToken); removeAccessToken(accessToken);
} }
} }
@Override @Override
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册