bug50853-解决redis失效导致没权限问题

This commit is contained in:
liyawei
2022-05-23 20:01:36 +08:00
parent 0e212adbae
commit 530699f82c
2 changed files with 10 additions and 2 deletions
@@ -1,5 +1,6 @@
package com.jero.common.system.vo;
import java.io.Serializable;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
@@ -21,7 +22,8 @@ import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class LoginUser {
public class LoginUser implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 登录人id
@@ -24,6 +24,7 @@ import com.jero.common.util.SpringContextUtils;
import com.jero.common.util.oConvertUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.redis.serializer.SerializationException;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@@ -128,7 +129,12 @@ public class ShiroRealm extends AuthorizingRealm {
// 查询用户信息
log.debug("———校验token是否有效————checkUserTokenIsEffect——————— "+ token);
LoginUser loginUser = commonAPI.getUserByName(username);
LoginUser loginUser = null;
try {
loginUser = commonAPI.getUserByName(username);
}catch (SerializationException e){
throw e;
}
if (loginUser == null) {
LoginException.loginException(401,"用户不存在!");
return null;