Commit e47f5418 authored by liqin's avatar liqin 💬

bug fixed

parent cdc14100
......@@ -32,7 +32,7 @@ public class MyShiroRealm extends AuthorizingRealm {
private static final Logger LOGGER = LoggerFactory.getLogger(MyShiroRealm.class);
private static final String SHIRO_JWT_TOKEN = "shiro:jwt:token";
private static final String SHIRO_JWT_TOKEN = "shiro:jwt:token:";
//用户登录次数计数 redisKey 前缀
private String SHIRO_LOGIN_COUNT = "shiro_login_count_";
......@@ -76,12 +76,13 @@ public class MyShiroRealm extends AuthorizingRealm {
if (credentials == null) {
throw new AuthenticationException("token为空!");
}
LOGGER.info("MyShiroRealm doGetAuthenticationInfo().token=" + token);
Boolean hasToken = stringRedisTemplate.hasKey(SHIRO_JWT_TOKEN + token);
if (hasToken == null || !hasToken) {
throw new AuthenticationException("用户未登录!");
}
LOGGER.info("MyShiroRealm doGetAuthenticationInfo().token=" + token);
String username = JwtTokenUtil.getUsername(credentials);
if (username == null) {
throw new AuthenticationException("token invalid");
......
......@@ -53,7 +53,7 @@ public class LoginController {
@Resource
private SysLogController sysLogController;
private static final String SHIRO_JWT_TOKEN = "shiro:jwt:token";
private static final String SHIRO_JWT_TOKEN = "shiro:jwt:token:";
//用户登录次数计数 redisKey 前缀
private String SHIRO_LOGIN_COUNT = "shiro_login_count_";
//用户登录是否被锁定 一小时 redisKey 前缀
......
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