public abstract class JwtUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CLAIMS_KEY |
static String |
USER_ID_KEY |
| Constructor and Description |
|---|
JwtUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Map<String,Object> |
getMap(String token)
获取 token 中的 特别数据 Map
|
static String |
getToken(Long userId)
获取 token 并设置 token 过期时间为5天,在 token 中存储 userId
|
static String |
getToken(Map<String,Object> claims,
int second)
获取 token 并设置 token 过期时间,在 token 中存储特定数据
|
static String |
getToken(String key,
Object data,
int second)
获取 token 并设置 token 过期时间,在 token 中存储 userId
|
static Long |
getUserId(String token)
获取 token 中的 userId
|
static boolean |
isExpire(String token)
校验是否过期
|
public static final String USER_ID_KEY
public static final String CLAIMS_KEY
public static String getToken(Long userId)
userId - userIdpublic static String getToken(String key, Object data, int second)
key - keydata - 存储数据second - 过期时间(秒)public static String getToken(Map<String,Object> claims, int second)
public static Long getUserId(String token)
token - tokenpublic static Map<String,Object> getMap(String token)
token - tokenpublic static boolean isExpire(String token)
token - tokenCopyright © 2024. All rights reserved.