Package com.bytedesk.core.utils
Class JwtUtils
java.lang.Object
com.bytedesk.core.utils.JwtUtils
https://github.com/jwtk/jjwt#jws-create-key
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate long
calculateExpirationMs
(String channel) 根据渠道类型计算过期时间(毫秒)static ZonedDateTime
calculateExpirationTime
(String channel) 根据渠道类型计算过期时间(ZonedDateTime) 统一JWT和数据库token的过期时间处理generateJwtToken
(String username, String platform, String channel) https://github.com/jwtk/jjwt?private BytedeskProperties
getSubjectFromJwtToken
(String token) private SecretKey
validateJwtToken
(String authToken)
-
Constructor Details
-
JwtUtils
public JwtUtils()
-
-
Method Details
-
getBytedeskProperties
-
generateJwtToken
https://github.com/jwtk/jjwt?tab=readme-ov-file#creating-a-jwt 根据渠道类型生成JWT token,支持不同的过期时间- Parameters:
username
- 用户名platform
- 平台channel
- 渠道类型(web/mobile等)- Returns:
- JWT token字符串
-
calculateExpirationMs
根据渠道类型计算过期时间(毫秒)- Parameters:
channel
- 渠道类型- Returns:
- 过期时间(毫秒)
-
calculateExpirationTime
根据渠道类型计算过期时间(ZonedDateTime) 统一JWT和数据库token的过期时间处理- Parameters:
channel
- 渠道类型- Returns:
- ZonedDateTime 过期时间
-
validateJwtToken
-
getSubjectFromJwtToken
-
secretKey
-