|
|
|
@ -12,6 +12,8 @@ import eu.bitwalker.useragentutils.UserAgent;
|
|
|
|
|
import io.jsonwebtoken.Claims;
|
|
|
|
|
import io.jsonwebtoken.Jwts;
|
|
|
|
|
import io.jsonwebtoken.SignatureAlgorithm;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
@ -29,6 +31,7 @@ import java.util.concurrent.TimeUnit;
|
|
|
|
|
@Component
|
|
|
|
|
public class UserTokenService
|
|
|
|
|
{
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(UserTokenService.class);
|
|
|
|
|
// 令牌自定义标识
|
|
|
|
|
@Value("${token.header}")
|
|
|
|
|
private String header;
|
|
|
|
@ -169,6 +172,7 @@ public class UserTokenService
|
|
|
|
|
loginUser.setExpireTime(loginUser.getLoginTime() + appExpireTime * MILLIS_MINUTE);
|
|
|
|
|
// 根据uuid将loginUser缓存
|
|
|
|
|
String userKey = getTokenKey(loginUser.getToken());
|
|
|
|
|
logger.info("login user :{} , login user key :{}", loginUser.getUsername(), userKey);
|
|
|
|
|
redisCache.setCacheObject(userKey, loginUser, appExpireTime, TimeUnit.MINUTES);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|