package com.lion.util;

import javax.servlet.http.HttpServletRequest;

import com.lion.config.LoginUserInfoCache;
import com.lion.entity.LoginUserInfo;

public class TokenUtil {
	/**重新设置登录用户缓存数据
	 * @param userId
	 * @param userInfo
	 */
	public static void setLoginUserInfo(String cookie,LoginUserInfo userInfo){
		LoginUserInfoCache.add(cookie,userInfo);
	}
	/**获取当前登录用户信息
	 * @param req
	 * @return
	 */
	public static LoginUserInfo getUserInfo(HttpServletRequest req){
		String token=req.getHeader("token");
		return LoginUserInfoCache.getLoginUserInfoByToken(token);
	}
}
