加入自动刷新RefreshToken的逻辑

This commit is contained in:
BBIT-Kai
2025-12-02 13:48:24 +08:00
parent eeada99dbb
commit c53926afd6
12 changed files with 29 additions and 128 deletions
@@ -152,7 +152,6 @@ fun Application.User(config: AppConfig) {
generateRefreshToken(config, userId)
)
)
BaseResponse(data = generateAccessToken(config, userId))
} catch (ex: Exception) {
BaseResponse(status = false, message = "token解析错误", data = null)
}
@@ -21,7 +21,7 @@ object TokenUtils {
}
fun generateRefreshToken(config: AppConfig, userId: UUID): Token {
return generateToken(config, userId, 10 * 24 * 60 * 60, "refresh_token")
return generateToken(config, userId, 20 * 24 * 60 * 60, "refresh_token")
}
fun getUserIdByToken(call: ApplicationCall) : UUID{
@@ -13,7 +13,6 @@ fun Application.configureCORS() {
anyHost()
allowHost("localhost:8089")
allowHost("127.0.0.1:8089")
allowHost("171.212.101.199:8089")
allowHost("ai.ronsunny.cn:8089")
// 进一步配置 CORS