mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-08 01:48:33 +08:00
commit
85c0c2dbc1
@ -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;
|
|||||||
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 {
|
|||||||
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);
|
||||||
|
conn.getPipeline().del(accessKey);
|
||||||
|
conn.getPipeline().del(accessToRefreshKey);
|
||||||
//Don't remove the refresh token - it's up to the caller to do that
|
//Don't remove the refresh token - it's up to the caller to do that
|
||||||
conn.delete(authKey);
|
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 {
|
|||||||
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 {
|
|||||||
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 {
|
|||||||
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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user