签入版本
This commit is contained in:
+2
-2
@@ -62,7 +62,7 @@ func Sign(ctx context.Context, tokenType string, userID, tenantID int, username,
|
||||
now := time.Now()
|
||||
expireSec := cfgDuration(ctx, "jwt.accessTokenExpire", 2*time.Hour)
|
||||
if tokenType == TokenTypeRefresh {
|
||||
expireSec = cfgDuration(ctx, "jwt.refreshExpire", 168*time.Hour)
|
||||
expireSec = cfgDuration(ctx, "jwt.refreshTokenExpire", 168*time.Hour)
|
||||
}
|
||||
claims := &Claims{
|
||||
UserID: userID,
|
||||
@@ -119,7 +119,7 @@ func errInvalidToken() error {
|
||||
// 用于黑名单 TTL 计算
|
||||
func ExpireDuration(ctx context.Context, tokenType string) time.Duration {
|
||||
if tokenType == TokenTypeRefresh {
|
||||
return cfgDuration(ctx, "jwt.refreshExpire", 168*time.Hour)
|
||||
return cfgDuration(ctx, "jwt.refreshTokenExpire", 168*time.Hour)
|
||||
}
|
||||
return cfgDuration(ctx, "jwt.accessTokenExpire", 2*time.Hour)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user