@Component public class JwtUtil extends Object
| Constructor and Description |
|---|
JwtUtil(JwtProperties jwtProperties) |
| Modifier and Type | Method and Description |
|---|---|
static String |
generateToken(String username,
String salt,
Duration expireDuration)
生成JWT Token
|
static Date |
getExpireDate(String token)
获取过期时间
|
static Date |
getIssuedAt(String token)
获取创建时间
|
static com.auth0.jwt.interfaces.DecodedJWT |
getJwtInfo(String token)
解析token,获取token数据
|
static String |
getUsername(String token)
获取用户名
|
static boolean |
isExpired(String token)
判断token是否已过期
|
static boolean |
verifyToken(String token,
String salt) |
public JwtUtil(JwtProperties jwtProperties)
public static String generateToken(String username, String salt, Duration expireDuration)
username - 用户名salt - 盐值expireDuration - 过期时间和单位public static com.auth0.jwt.interfaces.DecodedJWT getJwtInfo(String token)
token - public static boolean isExpired(String token)
token - Copyright © 2019. All rights reserved.