Commit 776e7612 by guojuxing

通过token查询登录信息

parent b3067426
......@@ -46,6 +46,18 @@ public class UserContext {
return new UserDetail();
}
public UserDetail getByToken(String token) {
if(StringUtils.isBlank(token)){
return new UserDetail();
}
String key = Constants.TOKEN_KEY + token;
Object cache = RedisUtil.getCache(key);
if(cache != null){
return (UserDetail) cache;
}
return new UserDetail();
}
public void init(UserDetail userDetail){
String uuId = ToolUtil.randomUUID();
String key = Constants.TOKEN_KEY+uuId;
......
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