public class JWTUtil extends Object
Constructor and Description |
---|
JWTUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
createToken(Map<String,Object> payload,
byte[] key)
创建HS256(HmacSHA256) JWT Token
|
static String |
createToken(Map<String,Object> payload,
JWTSigner signer)
创建JWT Token
|
static String |
createToken(Map<String,Object> headers,
Map<String,Object> payload,
byte[] key)
创建HS256(HmacSHA256) JWT Token
|
static String |
createToken(Map<String,Object> headers,
Map<String,Object> payload,
JWTSigner signer)
创建JWT Token
|
static JWT |
parseToken(String token)
解析JWT Token
|
static boolean |
verify(String token,
byte[] key)
验证JWT Token有效性
|
static boolean |
verify(String token,
JWTSigner signer)
验证JWT Token有效性
|
public static String createToken(Map<String,Object> payload, byte[] key)
payload
- 荷载信息key
- HS256(HmacSHA256)密钥public static String createToken(Map<String,Object> headers, Map<String,Object> payload, byte[] key)
headers
- 头信息payload
- 荷载信息key
- HS256(HmacSHA256)密钥public static String createToken(Map<String,Object> payload, JWTSigner signer)
payload
- 荷载信息signer
- 签名算法public static String createToken(Map<String,Object> headers, Map<String,Object> payload, JWTSigner signer)
headers
- 头信息payload
- 荷载信息signer
- 签名算法public static JWT parseToken(String token)
token
- tokenJWT
public static boolean verify(String token, byte[] key)
token
- JWT Tokenkey
- HS256(HmacSHA256)密钥Copyright © 2024. All rights reserved.