public class SecurityJwtUtil extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static Integer |
AUTH_LENGTH |
static String |
BEARER |
private static AtomicReference<org.springframework.data.redis.core.RedisTemplate<String,Object>> |
redisTemplateRef |
private static AtomicReference<SecurityJwtInfo> |
securityJwtInfoRef |
private static String |
TOKEN_CACHE |
private static String |
TOKEN_KEY |
| 构造器和说明 |
|---|
SecurityJwtUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
addAccessToken(String tenantId,
String userId,
String accessToken,
int expire)
添加token至redis。
|
static String |
getAccessToken(String tenantId,
String userId,
String accessToken)
获取保存在redis的token。
|
static String |
getAccessTokenKey(String tenantId,
String userId,
String accessToken)
获取token索引。
|
static String |
getBase64Security()
签名加密。
|
static org.springframework.data.redis.core.RedisTemplate<String,Object> |
getRedisTemplate() |
static SecurityJwtInfo |
getSecurityJwtInfo() |
static String |
getToken(String auth)
获取请求传递的token串。
|
static io.jsonwebtoken.Claims |
parseJWT(String jsonWebToken)
解析jsonWebToken。
|
static void |
removeAccessToken(String tenantId,
String userId)
删除保存在redis的token。
|
static void |
removeAccessToken(String tenantId,
String userId,
String accessToken)
删除保存在redis的token。
|
static void |
setRedisTemplate(org.springframework.data.redis.core.RedisTemplate<String,Object> redisTemplate) |
static void |
setSecurityJwtInfo(SecurityJwtInfo securityJwtInfo) |
public static String BEARER
public static Integer AUTH_LENGTH
private static AtomicReference<SecurityJwtInfo> securityJwtInfoRef
private static AtomicReference<org.springframework.data.redis.core.RedisTemplate<String,Object>> redisTemplateRef
public static SecurityJwtInfo getSecurityJwtInfo()
public static void setSecurityJwtInfo(SecurityJwtInfo securityJwtInfo)
public static org.springframework.data.redis.core.RedisTemplate<String,Object> getRedisTemplate()
public static void setRedisTemplate(org.springframework.data.redis.core.RedisTemplate<String,Object> redisTemplate)
public static String getBase64Security()
public static io.jsonwebtoken.Claims parseJWT(String jsonWebToken)
jsonWebToken - token串public static String getAccessToken(String tenantId, String userId, String accessToken)
tenantId - 租户iduserId - 用户idaccessToken - tokenpublic static void addAccessToken(String tenantId, String userId, String accessToken, int expire)
tenantId - 租户iduserId - 用户idaccessToken - tokenexpire - 过期时间public static void removeAccessToken(String tenantId, String userId)
tenantId - 租户iduserId - 用户idpublic static void removeAccessToken(String tenantId, String userId, String accessToken)
tenantId - 租户iduserId - 用户idaccessToken - tokenCopyright © 2022 Zodiac. All rights reserved.