fix #I1X2U5 redis的increment命令的反序列化问题

This commit is contained in:
zlt2000
2020-09-30 17:01:19 +08:00
parent a050756d9f
commit c7105dd327
5 changed files with 69 additions and 7 deletions
@@ -10,6 +10,7 @@ import com.central.oauth.service.ITokensService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.provider.OAuth2Request;
@@ -40,8 +41,10 @@ public class RedisTokensServiceImpl implements ITokensService {
String redisKey = getRedisKey(params, clientId);
long size = redisRepository.length(redisKey);
List<TokenVo> result = new ArrayList<>(limit);
RedisSerializer<Object> valueSerializer = RedisSerializer.java();
//查询token集合
List<Object> tokenObjs = redisRepository.getList(redisKey, startEnds[0], startEnds[1]-1);
//redisRepository.getRedisTemplate().e
List<Object> tokenObjs = redisRepository.getList(redisKey, startEnds[0], startEnds[1]-1, valueSerializer);
if (tokenObjs != null) {
for (Object obj : tokenObjs) {
DefaultOAuth2AccessToken accessToken = (DefaultOAuth2AccessToken)obj;
@@ -51,7 +54,7 @@ public class RedisTokensServiceImpl implements ITokensService {
tokenVo.setExpiration(accessToken.getExpiration());
//获取用户信息
Object authObj = redisRepository.get(SecurityConstants.REDIS_TOKEN_AUTH + accessToken.getValue());
Object authObj = redisRepository.get(SecurityConstants.REDIS_TOKEN_AUTH + accessToken.getValue(), valueSerializer);
OAuth2Authentication authentication = (OAuth2Authentication)authObj;
if (authentication != null) {
OAuth2Request request = authentication.getOAuth2Request();