|
@@ -1,7 +1,7 @@
|
|
|
package org.jeecg.modules.shiro.authc;
|
|
|
|
|
|
-import java.util.Set;
|
|
|
-
|
|
|
+import cn.com.ctop.common.module.utils.Check;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.shiro.authc.AuthenticationException;
|
|
|
import org.apache.shiro.authc.AuthenticationInfo;
|
|
|
import org.apache.shiro.authc.AuthenticationToken;
|
|
@@ -22,7 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
+import java.util.Set;
|
|
|
|
|
|
/**
|
|
|
* @Description: 用户登录鉴权和获取用户授权
|
|
@@ -99,13 +99,18 @@ public class ShiroRealm extends AuthorizingRealm {
|
|
|
* @param token
|
|
|
*/
|
|
|
public LoginUser checkUserTokenIsEffect(String token) throws AuthenticationException {
|
|
|
+ if (Check.isNull(token)) {
|
|
|
+ log.error("token为空");
|
|
|
+ return null;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
// 解密获得username,用于和数据库进行对比
|
|
|
String username = JwtUtil.getUsername(token);
|
|
|
if (username == null) {
|
|
|
log.error("token非法无效!");
|
|
|
// throw new AuthenticationException("token非法无效!");
|
|
|
}
|
|
|
-
|
|
|
// 查询用户信息
|
|
|
LoginUser loginUser = new LoginUser();
|
|
|
SysUser sysUser = sysUserService.getUserByName(username);
|