Commit 21cd7a88 authored by 赵啸非's avatar 赵啸非

修改redis鉴权确认

parent 5c1ce1ab
...@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -106,19 +107,20 @@ public class AuthTokenServiceImpl implements IAuthTokenService { ...@@ -106,19 +107,20 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
Claims claims = parseToken(token); Claims claims = parseToken(token);
String uuid = (String) claims.get(SysConstains.LOGIN_USER_KEY); String uuid = (String) claims.get(SysConstains.LOGIN_USER_KEY);
String userKey = getTokenKey(uuid); String userKey = getTokenKey(uuid);
cacheService.select(portalDb); // cacheService.select(portalDb);
String userStr = cacheService.get(userKey);
RedisTemplate<String, String> redisTemplate = cacheService.selectDbRedisTemplate(portalDb);
String userStr =redisTemplate.opsForValue().get(userKey);
// String userStr = cacheService.get(userKey);
//刷新token时间 //刷新token时间
UserEntity userEntity = JSONObject.parseObject(userStr, UserEntity.class); UserEntity userEntity = JSONObject.parseObject(userStr, UserEntity.class);
if (!ObjectUtils.isEmpty(userEntity)) { if (!ObjectUtils.isEmpty(userEntity)) {
verifyToken(userEntity); verifyToken(userEntity);
} }
cacheService.select(db); // cacheService.select(db);
if (!ObjectUtils.isEmpty(userEntity)) { if (!ObjectUtils.isEmpty(userEntity)) {
// UserEntity temp = userService.selectOne(new UserQuery().loginName(userEntity.getLoginName()));
// if(!ObjectUtils.isEmpty(temp)){
// userEntity.setId(temp.getId());
// }
UserEntity temp = userService.getExtCache(userEntity.getLoginName()); UserEntity temp = userService.getExtCache(userEntity.getLoginName());
if (!ObjectUtils.isEmpty(temp)) { if (!ObjectUtils.isEmpty(temp)) {
userEntity.setId(temp.getId()); userEntity.setId(temp.getId());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment