Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat(auth): add separate access and refresh token duration settings (#18652)

p0nyd292483b018b
diff --git a/backend/api/auth/auth.go b/backend/api/auth/auth.go
index faa5685ec7..c4862a48c4 100644
--- a/backend/api/auth/auth.go
+++ b/backend/api/auth/auth.go
@@ -40,8 +40,10 @@ const (
// OAuth2AccessTokenAudience is the audience for OAuth2 access tokens.
OAuth2AccessTokenAudience = "bb.oauth2.access"
apiTokenDuration = 1 * time.Hour
- // DefaultTokenDuration is the default token expiration duration.
- DefaultTokenDuration = 7 * 24 * time.Hour
+ // DefaultAccessTokenDuration is the default access token expiration duration.
+ DefaultAccessTokenDuration = 1 * time.Hour
+ // DefaultRefreshTokenDuration is the default refresh token expiration duration.
+ DefaultRefreshTokenDuration = 7 * 24 * time.Hour
// AccessTokenCookieName is the cookie name of access token.
AccessTokenCookieName = "access-token"
diff --git a/backend/api/auth/header.go b/backend/api/auth/header.go
index 403af71954..5165e45873 100644
--- a/backend/api/auth/header.go
+++ b/backend/api/auth/header.go
@@ -22,7 +22,7 @@ func GetTokenCookie(ctx context.Context, stores *store.Store, licenseService *en
}
}
isHTTPS := strings.HasPrefix(origin, "https")
- tokenDuration := GetTokenDuration(ctx, stores, licenseService)
+ tokenDuration := GetAccessTokenDuration(ctx, stores, licenseService)
return &http.Cookie{
Name: AccessTokenCookieName,
Value: token,
@@ -41,36 +41,56 @@ func GetTokenCookie(ctx context.Context, stores *store.Store, licenseService *en
}
}
-func GetTokenDuration(ctx context.Context, store *store.Store, licenseService *enterprise.LicenseService) time.Duration {
- tokenDuration := DefaultTokenDuration
+func GetAccessTokenDuration(ctx context.Context, store *store.Store, licenseService *enterprise.LicenseService) time.Duration {
+ accessTokenDuration := DefaultAccessTokenDuration
// If the sign-in frequency control feature is not enabled, return default duration
if err := licenseService.IsFeatureEnabled(v1pb.PlanFeature_FEATURE_SIGN_IN_FREQUENCY_CONTROL); err != nil {
- return tokenDuration
+ return accessTokenDuration
}
workspaceProfile, err := store.GetWorkspaceProfileSetting(ctx)
if err != nil {
- return tokenDuration
+ return accessTokenDuration
}
- if workspaceProfile.GetTokenDuration().GetSeconds() > 0 {
- tokenDuration = workspaceProfile.GetTokenDuration().AsDuration()
+ if workspaceProfile.GetAccessTokenDuration().GetSeconds() > 0 {
+ accessTokenDuration = workspaceProfile.GetAccessTokenDuration().AsDuration()
+ }
+
+ return accessTokenDuration
+}
+
+func GetRefreshTokenDuration(ctx context.Context, store *store.Store, licenseService *enterprise.LicenseService) time.Duration {
+ refreshTokenDuration := DefaultRefreshTokenDuration
+
+ // If the sign-in frequency control feature is not enabled, return default duration
+ if err := licenseService.IsFeatureEnabled(v1pb.PlanFeature_FEATURE_SIGN_IN_FREQUENCY_CONTROL); err != nil {
+ return refreshTokenDuration
+ }
+
+ workspaceProfile, err := store.GetWorkspaceProfileSetting(ctx)
+ if err != nil {
+ return refreshTokenDuration
+ }
+
+ if workspaceProfile.GetRefreshTokenDuration().GetSeconds() > 0 {
+ refreshTokenDuration = workspaceProfile.GetRefreshTokenDuration().AsDuration()
}
// Currently we implement the password rotation restriction in a simple way:
// 1. Only check if users need to reset their password during login.
// 2. For the 1st time login, if `RequireResetPasswordForFirstLogin` is true, `require_reset_password` in the response will be true
// 3. Otherwise if the `PasswordRotation` exists, check the password last updated time to decide if the `require_reset_password` is true.
- // So we will use the minimum value between (`workspaceProfile.TokenDuration`, `passwordRestriction.PasswordRotation`) to force to expire the token.
+ // So we will use the minimum value between (`refreshTokenDuration`, `passwordRestriction.PasswordRotation`) to force to expire the token.
passwordRestriction := workspaceProfile.GetPasswordRestriction()
if passwordRestriction.GetPasswordRotation().GetSeconds() > 0 {
passwordRotation := passwordRestriction.GetPasswordRotation().AsDuration()
- if passwordRotation.Seconds() < tokenDuration.Seconds() {
- tokenDuration = passwordRotation
+ if passwordRotation.Seconds() < refreshTokenDuration.Seconds() {
+ refreshTokenDuration = passwordRotation
}
}
- return tokenDuration
+ return refreshTokenDuration
}
const RefreshTokenCookieName = "refresh-token"
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index 405f2c3f72..6878dfcebb 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -17709,9 +17709,13 @@ components:
type: boolean
title: require_2fa
description: Require 2FA for all users.
- tokenDuration:
- title: token_duration
- description: The duration for token.
+ refreshTokenDuration:
+ title: refresh_token_duration
+ description: The duration for refresh token. Default is 7 days.
+ $ref: '#/components/schemas/google.protobuf.Duration'
+ accessTokenDuration:
+ title: access_token_duration
+ description: The duration for access token. Default is 1 hour.
$ref: '#/components/schemas/google.protobuf.Duration'
announcement:
title: announcement
diff --git a/backend/api/v1/actuator_service.go b/backend/api/v1/actuator_service.go
index acfe3b202d..e5794ca73b 100644
--- a/backend/api/v1/actuator_service.go
+++ b/backend/api/v1/actuator_service.go
@@ -238,7 +238,7 @@ func (s *ActuatorService) getUsedFeatures(ctx context.Context) ([]v1pb.PlanFeatu
if setting.Require_2Fa {
features = append(features, v1pb.PlanFeature_FEATURE_TWO_FA)
}
- if setting.GetTokenDuration().GetSeconds() > 0 && float64(setting.GetTokenDuration().GetSeconds()) != auth.DefaultTokenDuration.Seconds() {
+ if setting.GetRefreshTokenDuration().GetSeconds() > 0 && float64(setting.GetRefreshTokenDuration().GetSeconds()) != auth.DefaultRefreshTokenDuration.Seconds() {
features = append(features, v1pb.PlanFeature_FEATURE_SIGN_IN_FREQUENCY_CONTROL)
}
if setting.GetAnnouncement().GetText() != "" {
diff --git a/backend/api/v1/auth_service.go b/backend/api/v1/auth_service.go
index bc5d5500b4..e562e7344a 100644
--- a/backend/api/v1/auth_service.go
+++ b/backend/api/v1/auth_service.go
@@ -84,14 +84,6 @@ func NewAuthService(store *store.Store, secret string, licenseService *enterpris
}
}
-// GetRefreshTokenDuration returns the configured refresh token duration or default.
-func GetRefreshTokenDuration(_ context.Context, _ *store.Store, _ *enterprise.LicenseService) time.Duration {
- // TODO: Add refresh_token_duration field to WorkspaceProfileSetting proto
- // and implement workspace setting-based configuration similar to GetTokenDuration.
- // For now, use a fixed 30-day duration.
- return 30 * 24 * time.Hour
-}
-
// Login is the auth login method including SSO.
func (s *AuthService) Login(ctx context.Context, req *connect.Request[v1pb.LoginRequest]) (*connect.Response[v1pb.LoginResponse], error) {
request := req.Msg
@@ -246,13 +238,13 @@ func (s *AuthService) Refresh(ctx context.Context, req *connect.Request[v1pb.Ref
}
// 7. Issue new tokens
- accessTokenDuration := auth.GetTokenDuration(ctx, s.store, s.licenseService)
+ accessTokenDuration := auth.GetAccessTokenDuration(ctx, s.store, s.licenseService)
accessToken, err := auth.GenerateAccessToken(user.Email, s.profile.Mode, s.secret, accessTokenDuration)
if err != nil {
return nil, connect.NewError(connect.CodeInternal, errors.Wrap(err, "failed to generate access token"))
}
- refreshTokenDuration := GetRefreshTokenDuration(ctx, s.store, s.licenseService)
+ refreshTokenDuration := auth.GetRefreshTokenDuration(ctx, s.store, s.licenseService)
newRefreshToken, err := auth.GenerateOpaqueToken()
if err != nil {
return nil, connect.NewError(connect.CodeInternal, errors.Wrap(err, "failed to generate refresh token"))
@@ -768,7 +760,7 @@ func (s *AuthService) checkMFARequired(user *store.UserMessage, mfaSecondLogin b
// generateLoginToken generates the appropriate token based on user type.
func (s *AuthService) generateLoginToken(ctx context.Context, user *store.UserMessage) (string, error) {
- tokenDuration := auth.GetTokenDuration(ctx, s.store, s.licenseService)
+ tokenDuration := auth.GetAccessTokenDuration(ctx, s.store, s.licenseService)
switch user.Type {
case storepb.PrincipalType_END_USER:
@@ -800,7 +792,7 @@ func (s *AuthService) finalizeLogin(ctx context.Context, req *connect.Request[v1
if err != nil {
return nil, connect.NewError(connect.CodeInternal, errors.Wrap(err, "failed to generate refresh token"))
}
- refreshTokenDuration := GetRefreshTokenDuration(ctx, s.store, s.licenseService)
+ refreshTokenDuration := auth.GetRefreshTokenDuration(ctx, s.store, s.licenseService)
if err := s.store.CreateWebRefreshToken(ctx, &store.WebRefreshTokenMessage{
TokenHash: auth.HashToken(refreshToken),
UserEmail: user.Email,
diff --git a/backend/api/v1/setting_service.go b/backend/api/v1/setting_service.go
index 7235b9f194..938f8a1f66 100644
--- a/backend/api/v1/setting_service.go
+++ b/backend/api/v1/setting_service.go
@@ -196,14 +196,22 @@ func (s *SettingService) UpdateSetting(ctx context.Context, request *connect.Req
return nil, connect.NewError(connect.CodePermissionDenied, err)
}
oldSetting.Require_2Fa = payload.Require_2Fa
- case "value.workspace_profile.token_duration":
+ case "value.workspace_profile.access_token_duration":
if err := s.licenseService.IsFeatureEnabled(v1pb.PlanFeature_FEATURE_SIGN_IN_FREQUENCY_CONTROL); err != nil {
return nil, connect.NewError(connect.CodePermissionDenied, err)
}
- if payload.TokenDuration != nil && payload.TokenDuration.Seconds > 0 && payload.TokenDuration.AsDuration() < time.Hour {
+ if payload.AccessTokenDuration != nil && payload.AccessTokenDuration.Seconds > 0 && payload.AccessTokenDuration.AsDuration() < time.Minute {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("access token duration should be at least one minute"))
+ }
+ oldSetting.AccessTokenDuration = payload.AccessTokenDuration
+ case "value.workspace_profile.refresh_token_duration":
+ if err := s.licenseService.IsFeatureEnabled(v1pb.PlanFeature_FEATURE_SIGN_IN_FREQUENCY_CONTROL); err != nil {
+ return nil, connect.NewError(connect.CodePermissionDenied, err)
+ }
+ if payload.RefreshTokenDuration != nil && payload.RefreshTokenDuration.Seconds > 0 && payload.RefreshTokenDuration.AsDuration() < time.Hour {
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("refresh token duration should be at least one hour"))
}
- oldSetting.TokenDuration = payload.TokenDuration
+ oldSetting.RefreshTokenDuration = payload.RefreshTokenDuration
case "value.workspace_profile.inactive_session_timeout":
if err := s.licenseService.IsFeatureEnabled(v1pb.PlanFeature_FEATURE_SIGN_IN_FREQUENCY_CONTROL); err != nil {
return nil, connect.NewError(connect.CodePermissionDenied, err)
diff --git a/backend/api/v1/setting_service_converter.go b/backend/api/v1/setting_service_converter.go
index dce00c298a..6924902fc4 100644
--- a/backend/api/v1/setting_service_converter.go
+++ b/backend/api/v1/setting_service_converter.go
@@ -239,7 +239,8 @@ func convertWorkspaceProfileSetting(v1Setting *v1pb.WorkspaceProfileSetting) *st
ExternalUrl: v1Setting.ExternalUrl,
DisallowSignup: v1Setting.DisallowSignup,
Require_2Fa: v1Setting.Require_2Fa,
- TokenDuration: v1Setting.TokenDuration,
+ RefreshTokenDuration: v1Setting.RefreshTokenDuration,
+ AccessTokenDuration: v1Setting.AccessTokenDuration,
InactiveSessionTimeout: v1Setting.InactiveSessionTimeout,
MaximumRoleExpiration: v1Setting.MaximumRoleExpiration,
Domains: v1Setting.Domains,
@@ -286,7 +287,8 @@ func convertToWorkspaceProfileSetting(storeSetting *storepb.WorkspaceProfileSett
ExternalUrl: storeSetting.ExternalUrl,
DisallowSignup: storeSetting.DisallowSignup,
Require_2Fa: storeSetting.Require_2Fa,
- TokenDuration: storeSetting.TokenDuration,
+ RefreshTokenDuration: storeSetting.RefreshTokenDuration,
+ AccessTokenDuration: storeSetting.AccessTokenDuration,
InactiveSessionTimeout: storeSetting.InactiveSessionTimeout,
MaximumRoleExpiration: storeSetting.MaximumRoleExpiration,
Domains: storeSetting.Domains,
diff --git a/backend/generated-go/store/setting.pb.go b/backend/generated-go/store/setting.pb.go
index 0615a130d8..87a3f3755f 100644
--- a/backend/generated-go/store/setting.pb.go
+++ b/backend/generated-go/store/setting.pb.go
@@ -426,8 +426,10 @@ type WorkspaceProfileSetting struct {
DisallowSignup bool `protobuf:"varint,2,opt,name=disallow_signup,json=disallowSignup,proto3" json:"disallow_signup,omitempty"`
// Require 2FA for all users.
Require_2Fa bool `protobuf:"varint,3,opt,name=require_2fa,json=require2fa,proto3" json:"require_2fa,omitempty"`
- // The duration for token.
- TokenDuration *durationpb.Duration `protobuf:"bytes,4,opt,name=token_duration,json=tokenDuration,proto3" json:"token_duration,omitempty"`
+ // The duration for refresh token. Default is 7 days.
+ RefreshTokenDuration *durationpb.Duration `protobuf:"bytes,4,opt,name=refresh_token_duration,json=refreshTokenDuration,proto3" json:"refresh_token_duration,omitempty"`
+ // The duration for access token. Default is 1 hour.
+ AccessTokenDuration *durationpb.Duration `protobuf:"bytes,18,opt,name=access_token_duration,json=accessTokenDuration,proto3" json:"access_token_duration,omitempty"`
// The setting of custom announcement
Announcement *WorkspaceProfileSetting_Announcement `protobuf:"bytes,5,opt,name=announcement,proto3" json:"announcement,omitempty"`
// The max duration for role expired.
@@ -511,9 +513,16 @@ func (x *WorkspaceProfileSetting) GetRequire_2Fa() bool {
return false
}
-func (x *WorkspaceProfileSetting) GetTokenDuration() *durationpb.Duration {
+func (x *WorkspaceProfileSetting) GetRefreshTokenDuration() *durationpb.Duration {
if x != nil {
- return x.TokenDuration
+ return x.RefreshTokenDuration
+ }
+ return nil
+}
+
+func (x *WorkspaceProfileSetting) GetAccessTokenDuration() *durationpb.Duration {
+ if x != nil {
+ return x.AccessTokenDuration
}
return nil
}
@@ -2377,13 +2386,14 @@ const file_store_setting_proto_rawDesc = "" +
"\vauth_secret\x18\x01 \x01(\tR\n" +
"authSecret\x12!\n" +
"\fworkspace_id\x18\x02 \x01(\tR\vworkspaceId\x12\x18\n" +
- "\alicense\x18\x03 \x01(\tR\alicense\"\xe6\r\n" +
+ "\alicense\x18\x03 \x01(\tR\alicense\"\xc4\x0e\n" +
"\x17WorkspaceProfileSetting\x12!\n" +
"\fexternal_url\x18\x01 \x01(\tR\vexternalUrl\x12'\n" +
"\x0fdisallow_signup\x18\x02 \x01(\bR\x0edisallowSignup\x12\x1f\n" +
"\vrequire_2fa\x18\x03 \x01(\bR\n" +
- "require2fa\x12@\n" +
- "\x0etoken_duration\x18\x04 \x01(\v2\x19.google.protobuf.DurationR\rtokenDuration\x12X\n" +
+ "require2fa\x12O\n" +
+ "\x16refresh_token_duration\x18\x04 \x01(\v2\x19.google.protobuf.DurationR\x14refreshTokenDuration\x12M\n" +
+ "\x15access_token_duration\x18\x12 \x01(\v2\x19.google.protobuf.DurationR\x13accessTokenDuration\x12X\n" +
"\fannouncement\x18\x05 \x01(\v24.bytebase.store.WorkspaceProfileSetting.AnnouncementR\fannouncement\x12Q\n" +
"\x17maximum_role_expiration\x18\x06 \x01(\v2\x19.google.protobuf.DurationR\x15maximumRoleExpiration\x12\x18\n" +
"\adomains\x18\a \x03(\tR\adomains\x126\n" +
@@ -2622,46 +2632,47 @@ var file_store_setting_proto_goTypes = []any{
(WebhookType)(0), // 40: bytebase.store.WebhookType
}
var file_store_setting_proto_depIdxs = []int32{
- 37, // 0: bytebase.store.WorkspaceProfileSetting.token_duration:type_name -> google.protobuf.Duration
- 15, // 1: bytebase.store.WorkspaceProfileSetting.announcement:type_name -> bytebase.store.WorkspaceProfileSetting.Announcement
- 37, // 2: bytebase.store.WorkspaceProfileSetting.maximum_role_expiration:type_name -> google.protobuf.Duration
- 1, // 3: bytebase.store.WorkspaceProfileSetting.database_change_mode:type_name -> bytebase.store.WorkspaceProfileSetting.DatabaseChangeMode
- 37, // 4: bytebase.store.WorkspaceProfileSetting.inactive_session_timeout:type_name -> google.protobuf.Duration
- 16, // 5: bytebase.store.WorkspaceProfileSetting.password_restriction:type_name -> bytebase.store.WorkspaceProfileSetting.PasswordRestriction
- 17, // 6: bytebase.store.WorkspaceApprovalSetting.rules:type_name -> bytebase.store.WorkspaceApprovalSetting.Rule
- 18, // 7: bytebase.store.DataClassificationSetting.configs:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig
- 22, // 8: bytebase.store.Algorithm.full_mask:type_name -> bytebase.store.Algorithm.FullMask
- 23, // 9: bytebase.store.Algorithm.range_mask:type_name -> bytebase.store.Algorithm.RangeMask
- 24, // 10: bytebase.store.Algorithm.md5_mask:type_name -> bytebase.store.Algorithm.MD5Mask
- 25, // 11: bytebase.store.Algorithm.inner_outer_mask:type_name -> bytebase.store.Algorithm.InnerOuterMask
- 27, // 12: bytebase.store.SemanticTypeSetting.types:type_name -> bytebase.store.SemanticTypeSetting.SemanticType
- 34, // 13: bytebase.store.AppIMSetting.settings:type_name -> bytebase.store.AppIMSetting.IMSetting
- 5, // 14: bytebase.store.AISetting.provider:type_name -> bytebase.store.AISetting.Provider
- 35, // 15: bytebase.store.EnvironmentSetting.environments:type_name -> bytebase.store.EnvironmentSetting.Environment
- 2, // 16: bytebase.store.WorkspaceProfileSetting.Announcement.level:type_name -> bytebase.store.WorkspaceProfileSetting.Announcement.AlertLevel
- 37, // 17: bytebase.store.WorkspaceProfileSetting.PasswordRestriction.password_rotation:type_name -> google.protobuf.Duration
- 38, // 18: bytebase.store.WorkspaceApprovalSetting.Rule.template:type_name -> bytebase.store.ApprovalTemplate
- 39, // 19: bytebase.store.WorkspaceApprovalSetting.Rule.condition:type_name -> google.type.Expr
- 3, // 20: bytebase.store.WorkspaceApprovalSetting.Rule.source:type_name -> bytebase.store.WorkspaceApprovalSetting.Rule.Source
- 19, // 21: bytebase.store.DataClassificationSetting.DataClassificationConfig.levels:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig.Level
- 21, // 22: bytebase.store.DataClassificationSetting.DataClassificationConfig.classification:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig.ClassificationEntry
- 20, // 23: bytebase.store.DataClassificationSetting.DataClassificationConfig.ClassificationEntry.value:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig.DataClassification
- 26, // 24: bytebase.store.Algorithm.RangeMask.slices:type_name -> bytebase.store.Algorithm.RangeMask.Slice
- 4, // 25: bytebase.store.Algorithm.InnerOuterMask.type:type_name -> bytebase.store.Algorithm.InnerOuterMask.MaskType
- 10, // 26: bytebase.store.SemanticTypeSetting.SemanticType.algorithm:type_name -> bytebase.store.Algorithm
- 40, // 27: bytebase.store.AppIMSetting.IMSetting.type:type_name -> bytebase.store.WebhookType
- 28, // 28: bytebase.store.AppIMSetting.IMSetting.slack:type_name -> bytebase.store.AppIMSetting.Slack
- 29, // 29: bytebase.store.AppIMSetting.IMSetting.feishu:type_name -> bytebase.store.AppIMSetting.Feishu
- 30, // 30: bytebase.store.AppIMSetting.IMSetting.wecom:type_name -> bytebase.store.AppIMSetting.Wecom
- 31, // 31: bytebase.store.AppIMSetting.IMSetting.lark:type_name -> bytebase.store.AppIMSetting.Lark
- 32, // 32: bytebase.store.AppIMSetting.IMSetting.dingtalk:type_name -> bytebase.store.AppIMSetting.DingTalk
- 33, // 33: bytebase.store.AppIMSetting.IMSetting.teams:type_name -> bytebase.store.AppIMSetting.Teams
- 36, // 34: bytebase.store.EnvironmentSetting.Environment.tags:type_name -> bytebase.store.EnvironmentSetting.Environment.TagsEntry
- 35, // [35:35] is the sub-list for method output_type
- 35, // [35:35] is the sub-list for method input_type
- 35, // [35:35] is the sub-list for extension type_name
- 35, // [35:35] is the sub-list for extension extendee
- 0, // [0:35] is the sub-list for field type_name
+ 37, // 0: bytebase.store.WorkspaceProfileSetting.refresh_token_duration:type_name -> google.protobuf.Duration
+ 37, // 1: bytebase.store.WorkspaceProfileSetting.access_token_duration:type_name -> google.protobuf.Duration
+ 15, // 2: bytebase.store.WorkspaceProfileSetting.announcement:type_name -> bytebase.store.WorkspaceProfileSetting.Announcement
+ 37, // 3: bytebase.store.WorkspaceProfileSetting.maximum_role_expiration:type_name -> google.protobuf.Duration
+ 1, // 4: bytebase.store.WorkspaceProfileSetting.database_change_mode:type_name -> bytebase.store.WorkspaceProfileSetting.DatabaseChangeMode
+ 37, // 5: bytebase.store.WorkspaceProfileSetting.inactive_session_timeout:type_name -> google.protobuf.Duration
+ 16, // 6: bytebase.store.WorkspaceProfileSetting.password_restriction:type_name -> bytebase.store.WorkspaceProfileSetting.PasswordRestriction
+ 17, // 7: bytebase.store.WorkspaceApprovalSetting.rules:type_name -> bytebase.store.WorkspaceApprovalSetting.Rule
+ 18, // 8: bytebase.store.DataClassificationSetting.configs:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig
+ 22, // 9: bytebase.store.Algorithm.full_mask:type_name -> bytebase.store.Algorithm.FullMask
+ 23, // 10: bytebase.store.Algorithm.range_mask:type_name -> bytebase.store.Algorithm.RangeMask
+ 24, // 11: bytebase.store.Algorithm.md5_mask:type_name -> bytebase.store.Algorithm.MD5Mask
+ 25, // 12: bytebase.store.Algorithm.inner_outer_mask:type_name -> bytebase.store.Algorithm.InnerOuterMask
+ 27, // 13: bytebase.store.SemanticTypeSetting.types:type_name -> bytebase.store.SemanticTypeSetting.SemanticType
+ 34, // 14: bytebase.store.AppIMSetting.settings:type_name -> bytebase.store.AppIMSetting.IMSetting
+ 5, // 15: bytebase.store.AISetting.provider:type_name -> bytebase.store.AISetting.Provider
+ 35, // 16: bytebase.store.EnvironmentSetting.environments:type_name -> bytebase.store.EnvironmentSetting.Environment
+ 2, // 17: bytebase.store.WorkspaceProfileSetting.Announcement.level:type_name -> bytebase.store.WorkspaceProfileSetting.Announcement.AlertLevel
+ 37, // 18: bytebase.store.WorkspaceProfileSetting.PasswordRestriction.password_rotation:type_name -> google.protobuf.Duration
+ 38, // 19: bytebase.store.WorkspaceApprovalSetting.Rule.template:type_name -> bytebase.store.ApprovalTemplate
+ 39, // 20: bytebase.store.WorkspaceApprovalSetting.Rule.condition:type_name -> google.type.Expr
+ 3, // 21: bytebase.store.WorkspaceApprovalSetting.Rule.source:type_name -> bytebase.store.WorkspaceApprovalSetting.Rule.Source
+ 19, // 22: bytebase.store.DataClassificationSetting.DataClassificationConfig.levels:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig.Level
+ 21, // 23: bytebase.store.DataClassificationSetting.DataClassificationConfig.classification:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig.ClassificationEntry
+ 20, // 24: bytebase.store.DataClassificationSetting.DataClassificationConfig.ClassificationEntry.value:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig.DataClassification
+ 26, // 25: bytebase.store.Algorithm.RangeMask.slices:type_name -> bytebase.store.Algorithm.RangeMask.Slice
+ 4, // 26: bytebase.store.Algorithm.InnerOuterMask.type:type_name -> bytebase.store.Algorithm.InnerOuterMask.MaskType
+ 10, // 27: bytebase.store.SemanticTypeSetting.SemanticType.algorithm:type_name -> bytebase.store.Algorithm
+ 40, // 28: bytebase.store.AppIMSetting.IMSetting.type:type_name -> bytebase.store.WebhookType
+ 28, // 29: bytebase.store.AppIMSetting.IMSetting.slack:type_name -> bytebase.store.AppIMSetting.Slack
+ 29, // 30: bytebase.store.AppIMSetting.IMSetting.feishu:type_name -> bytebase.store.AppIMSetting.Feishu
+ 30, // 31: bytebase.store.AppIMSetting.IMSetting.wecom:type_name -> bytebase.store.AppIMSetting.Wecom
+ 31, // 32: bytebase.store.AppIMSetting.IMSetting.lark:type_name -> bytebase.store.AppIMSetting.Lark
+ 32, // 33: bytebase.store.AppIMSetting.IMSetting.dingtalk:type_name -> bytebase.store.AppIMSetting.DingTalk
+ 33, // 34: bytebase.store.AppIMSetting.IMSetting.teams:type_name -> bytebase.store.AppIMSetting.Teams
+ 36, // 35: bytebase.store.EnvironmentSetting.Environment.tags:type_name -> bytebase.store.EnvironmentSetting.Environment.TagsEntry
+ 36, // [36:36] is the sub-list for method output_type
+ 36, // [36:36] is the sub-list for method input_type
+ 36, // [36:36] is the sub-list for extension type_name
+ 36, // [36:36] is the sub-list for extension extendee
+ 0, // [0:36] is the sub-list for field type_name
}
func init() { file_store_setting_proto_init() }
diff --git a/backend/generated-go/store/setting_equal.pb.go b/backend/generated-go/store/setting_equal.pb.go
index ea647153b9..c55285c5c4 100644
--- a/backend/generated-go/store/setting_equal.pb.go
+++ b/backend/generated-go/store/setting_equal.pb.go
@@ -93,7 +93,10 @@ func (x *WorkspaceProfileSetting) Equal(y *WorkspaceProfileSetting) bool {
if x.Require_2Fa != y.Require_2Fa {
return false
}
- if p, q := x.TokenDuration, y.TokenDuration; (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {
+ if p, q := x.RefreshTokenDuration, y.RefreshTokenDuration; (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {
+ return false
+ }
+ if p, q := x.AccessTokenDuration, y.AccessTokenDuration; (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {
return false
}
if !x.Announcement.Equal(y.Announcement) {
diff --git a/backend/generated-go/v1/setting_service.pb.go b/backend/generated-go/v1/setting_service.pb.go
index f74d6fc101..36efe816ea 100644
--- a/backend/generated-go/v1/setting_service.pb.go
+++ b/backend/generated-go/v1/setting_service.pb.go
@@ -869,8 +869,10 @@ type WorkspaceProfileSetting struct {
DisallowSignup bool `protobuf:"varint,2,opt,name=disallow_signup,json=disallowSignup,proto3" json:"disallow_signup,omitempty"`
// Require 2FA for all users.
Require_2Fa bool `protobuf:"varint,3,opt,name=require_2fa,json=require2fa,proto3" json:"require_2fa,omitempty"`
- // The duration for token.
- TokenDuration *durationpb.Duration `protobuf:"bytes,4,opt,name=token_duration,json=tokenDuration,proto3" json:"token_duration,omitempty"`
+ // The duration for refresh token. Default is 7 days.
+ RefreshTokenDuration *durationpb.Duration `protobuf:"bytes,4,opt,name=refresh_token_duration,json=refreshTokenDuration,proto3" json:"refresh_token_duration,omitempty"`
+ // The duration for access token. Default is 1 hour.
+ AccessTokenDuration *durationpb.Duration `protobuf:"bytes,18,opt,name=access_token_duration,json=accessTokenDuration,proto3" json:"access_token_duration,omitempty"`
// The setting of custom announcement
Announcement *Announcement `protobuf:"bytes,5,opt,name=announcement,proto3" json:"announcement,omitempty"`
// The max duration for role expired.
@@ -954,9 +956,16 @@ func (x *WorkspaceProfileSetting) GetRequire_2Fa() bool {
return false
}
-func (x *WorkspaceProfileSetting) GetTokenDuration() *durationpb.Duration {
+func (x *WorkspaceProfileSetting) GetRefreshTokenDuration() *durationpb.Duration {
if x != nil {
- return x.TokenDuration
+ return x.RefreshTokenDuration
+ }
+ return nil
+}
+
+func (x *WorkspaceProfileSetting) GetAccessTokenDuration() *durationpb.Duration {
+ if x != nil {
+ return x.AccessTokenDuration
}
return nil
}
@@ -2871,14 +2880,14 @@ const file_v1_setting_service_proto_rawDesc = "" +
"\x04lark\x18\x05 \x01(\v2\x1e.bytebase.v1.AppIMSetting.LarkH\x00R\x04lark\x12@\n" +
"\bdingtalk\x18\x06 \x01(\v2\".bytebase.v1.AppIMSetting.DingTalkH\x00R\bdingtalk\x127\n" +
"\x05teams\x18\a \x01(\v2\x1f.bytebase.v1.AppIMSetting.TeamsH\x00R\x05teamsB\t\n" +
- "\apayload\"\xf7\n" +
- "\n" +
+ "\apayload\"\xd5\v\n" +
"\x17WorkspaceProfileSetting\x12!\n" +
"\fexternal_url\x18\x01 \x01(\tR\vexternalUrl\x12'\n" +
"\x0fdisallow_signup\x18\x02 \x01(\bR\x0edisallowSignup\x12\x1f\n" +
"\vrequire_2fa\x18\x03 \x01(\bR\n" +
- "require2fa\x12@\n" +
- "\x0etoken_duration\x18\x04 \x01(\v2\x19.google.protobuf.DurationR\rtokenDuration\x12=\n" +
+ "require2fa\x12O\n" +
+ "\x16refresh_token_duration\x18\x04 \x01(\v2\x19.google.protobuf.DurationR\x14refreshTokenDuration\x12M\n" +
+ "\x15access_token_duration\x18\x12 \x01(\v2\x19.google.protobuf.DurationR\x13accessTokenDuration\x12=\n" +
"\fannouncement\x18\x05 \x01(\v2\x19.bytebase.v1.AnnouncementR\fannouncement\x12Q\n" +
"\x17maximum_role_expiration\x18\x06 \x01(\v2\x19.google.protobuf.DurationR\x15maximumRoleExpiration\x12\x18\n" +
"\adomains\x18\a \x03(\tR\adomains\x126\n" +
@@ -3096,51 +3105,52 @@ var file_v1_setting_service_proto_depIdxs = []int32{
20, // 10: bytebase.v1.SettingValue.ai:type_name -> bytebase.v1.AISetting
21, // 11: bytebase.v1.SettingValue.environment:type_name -> bytebase.v1.EnvironmentSetting
28, // 12: bytebase.v1.AppIMSetting.settings:type_name -> bytebase.v1.AppIMSetting.IMSetting
- 44, // 13: bytebase.v1.WorkspaceProfileSetting.token_duration:type_name -> google.protobuf.Duration
- 15, // 14: bytebase.v1.WorkspaceProfileSetting.announcement:type_name -> bytebase.v1.Announcement
- 44, // 15: bytebase.v1.WorkspaceProfileSetting.maximum_role_expiration:type_name -> google.protobuf.Duration
- 0, // 16: bytebase.v1.WorkspaceProfileSetting.database_change_mode:type_name -> bytebase.v1.DatabaseChangeMode
- 44, // 17: bytebase.v1.WorkspaceProfileSetting.inactive_session_timeout:type_name -> google.protobuf.Duration
- 29, // 18: bytebase.v1.WorkspaceProfileSetting.password_restriction:type_name -> bytebase.v1.WorkspaceProfileSetting.PasswordRestriction
- 2, // 19: bytebase.v1.Announcement.level:type_name -> bytebase.v1.Announcement.AlertLevel
- 30, // 20: bytebase.v1.WorkspaceApprovalSetting.rules:type_name -> bytebase.v1.WorkspaceApprovalSetting.Rule
- 31, // 21: bytebase.v1.DataClassificationSetting.configs:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig
- 35, // 22: bytebase.v1.SemanticTypeSetting.types:type_name -> bytebase.v1.SemanticTypeSetting.SemanticType
- 36, // 23: bytebase.v1.Algorithm.full_mask:type_name -> bytebase.v1.Algorithm.FullMask
- 37, // 24: bytebase.v1.Algorithm.range_mask:type_name -> bytebase.v1.Algorithm.RangeMask
- 38, // 25: bytebase.v1.Algorithm.md5_mask:type_name -> bytebase.v1.Algorithm.MD5Mask
- 39, // 26: bytebase.v1.Algorithm.inner_outer_mask:type_name -> bytebase.v1.Algorithm.InnerOuterMask
- 5, // 27: bytebase.v1.AISetting.provider:type_name -> bytebase.v1.AISetting.Provider
- 41, // 28: bytebase.v1.EnvironmentSetting.environments:type_name -> bytebase.v1.EnvironmentSetting.Environment
- 45, // 29: bytebase.v1.AppIMSetting.IMSetting.type:type_name -> bytebase.v1.WebhookType
- 22, // 30: bytebase.v1.AppIMSetting.IMSetting.slack:type_name -> bytebase.v1.AppIMSetting.Slack
- 23, // 31: bytebase.v1.AppIMSetting.IMSetting.feishu:type_name -> bytebase.v1.AppIMSetting.Feishu
- 24, // 32: bytebase.v1.AppIMSetting.IMSetting.wecom:type_name -> bytebase.v1.AppIMSetting.Wecom
- 25, // 33: bytebase.v1.AppIMSetting.IMSetting.lark:type_name -> bytebase.v1.AppIMSetting.Lark
- 26, // 34: bytebase.v1.AppIMSetting.IMSetting.dingtalk:type_name -> bytebase.v1.AppIMSetting.DingTalk
- 27, // 35: bytebase.v1.AppIMSetting.IMSetting.teams:type_name -> bytebase.v1.AppIMSetting.Teams
- 44, // 36: bytebase.v1.WorkspaceProfileSetting.PasswordRestriction.password_rotation:type_name -> google.protobuf.Duration
- 46, // 37: bytebase.v1.WorkspaceApprovalSetting.Rule.template:type_name -> bytebase.v1.ApprovalTemplate
- 47, // 38: bytebase.v1.WorkspaceApprovalSetting.Rule.condition:type_name -> google.type.Expr
- 3, // 39: bytebase.v1.WorkspaceApprovalSetting.Rule.source:type_name -> bytebase.v1.WorkspaceApprovalSetting.Rule.Source
- 32, // 40: bytebase.v1.DataClassificationSetting.DataClassificationConfig.levels:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.Level
- 34, // 41: bytebase.v1.DataClassificationSetting.DataClassificationConfig.classification:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.ClassificationEntry
- 33, // 42: bytebase.v1.DataClassificationSetting.DataClassificationConfig.ClassificationEntry.value:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.DataClassification
- 19, // 43: bytebase.v1.SemanticTypeSetting.SemanticType.algorithm:type_name -> bytebase.v1.Algorithm
- 40, // 44: bytebase.v1.Algorithm.RangeMask.slices:type_name -> bytebase.v1.Algorithm.RangeMask.Slice
- 4, // 45: bytebase.v1.Algorithm.InnerOuterMask.type:type_name -> bytebase.v1.Algorithm.InnerOuterMask.MaskType
- 42, // 46: bytebase.v1.EnvironmentSetting.Environment.tags:type_name -> bytebase.v1.EnvironmentSetting.Environment.TagsEntry
- 6, // 47: bytebase.v1.SettingService.ListSettings:input_type -> bytebase.v1.ListSettingsRequest
- 8, // 48: bytebase.v1.SettingService.GetSetting:input_type -> bytebase.v1.GetSettingRequest
- 10, // 49: bytebase.v1.SettingService.UpdateSetting:input_type -> bytebase.v1.UpdateSettingRequest
- 7, // 50: bytebase.v1.SettingService.ListSettings:output_type -> bytebase.v1.ListSettingsResponse
- 11, // 51: bytebase.v1.SettingService.GetSetting:output_type -> bytebase.v1.Setting
- 11, // 52: bytebase.v1.SettingService.UpdateSetting:output_type -> bytebase.v1.Setting
- 50, // [50:53] is the sub-list for method output_type
- 47, // [47:50] is the sub-list for method input_type
- 47, // [47:47] is the sub-list for extension type_name
- 47, // [47:47] is the sub-list for extension extendee
- 0, // [0:47] is the sub-list for field type_name
+ 44, // 13: bytebase.v1.WorkspaceProfileSetting.refresh_token_duration:type_name -> google.protobuf.Duration
+ 44, // 14: bytebase.v1.WorkspaceProfileSetting.access_token_duration:type_name -> google.protobuf.Duration
+ 15, // 15: bytebase.v1.WorkspaceProfileSetting.announcement:type_name -> bytebase.v1.Announcement
+ 44, // 16: bytebase.v1.WorkspaceProfileSetting.maximum_role_expiration:type_name -> google.protobuf.Duration
+ 0, // 17: bytebase.v1.WorkspaceProfileSetting.database_change_mode:type_name -> bytebase.v1.DatabaseChangeMode
+ 44, // 18: bytebase.v1.WorkspaceProfileSetting.inactive_session_timeout:type_name -> google.protobuf.Duration
+ 29, // 19: bytebase.v1.WorkspaceProfileSetting.password_restriction:type_name -> bytebase.v1.WorkspaceProfileSetting.PasswordRestriction
+ 2, // 20: bytebase.v1.Announcement.level:type_name -> bytebase.v1.Announcement.AlertLevel
+ 30, // 21: bytebase.v1.WorkspaceApprovalSetting.rules:type_name -> bytebase.v1.WorkspaceApprovalSetting.Rule
+ 31, // 22: bytebase.v1.DataClassificationSetting.configs:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig
+ 35, // 23: bytebase.v1.SemanticTypeSetting.types:type_name -> bytebase.v1.SemanticTypeSetting.SemanticType
+ 36, // 24: bytebase.v1.Algorithm.full_mask:type_name -> bytebase.v1.Algorithm.FullMask
+ 37, // 25: bytebase.v1.Algorithm.range_mask:type_name -> bytebase.v1.Algorithm.RangeMask
+ 38, // 26: bytebase.v1.Algorithm.md5_mask:type_name -> bytebase.v1.Algorithm.MD5Mask
+ 39, // 27: bytebase.v1.Algorithm.inner_outer_mask:type_name -> bytebase.v1.Algorithm.InnerOuterMask
+ 5, // 28: bytebase.v1.AISetting.provider:type_name -> bytebase.v1.AISetting.Provider
+ 41, // 29: bytebase.v1.EnvironmentSetting.environments:type_name -> bytebase.v1.EnvironmentSetting.Environment
+ 45, // 30: bytebase.v1.AppIMSetting.IMSetting.type:type_name -> bytebase.v1.WebhookType
+ 22, // 31: bytebase.v1.AppIMSetting.IMSetting.slack:type_name -> bytebase.v1.AppIMSetting.Slack
+ 23, // 32: bytebase.v1.AppIMSetting.IMSetting.feishu:type_name -> bytebase.v1.AppIMSetting.Feishu
+ 24, // 33: bytebase.v1.AppIMSetting.IMSetting.wecom:type_name -> bytebase.v1.AppIMSetting.Wecom
+ 25, // 34: bytebase.v1.AppIMSetting.IMSetting.lark:type_name -> bytebase.v1.AppIMSetting.Lark
+ 26, // 35: bytebase.v1.AppIMSetting.IMSetting.dingtalk:type_name -> bytebase.v1.AppIMSetting.DingTalk
+ 27, // 36: bytebase.v1.AppIMSetting.IMSetting.teams:type_name -> bytebase.v1.AppIMSetting.Teams
+ 44, // 37: bytebase.v1.WorkspaceProfileSetting.PasswordRestriction.password_rotation:type_name -> google.protobuf.Duration
+ 46, // 38: bytebase.v1.WorkspaceApprovalSetting.Rule.template:type_name -> bytebase.v1.ApprovalTemplate
+ 47, // 39: bytebase.v1.WorkspaceApprovalSetting.Rule.condition:type_name -> google.type.Expr
+ 3, // 40: bytebase.v1.WorkspaceApprovalSetting.Rule.source:type_name -> bytebase.v1.WorkspaceApprovalSetting.Rule.Source
+ 32, // 41: bytebase.v1.DataClassificationSetting.DataClassificationConfig.levels:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.Level
+ 34, // 42: bytebase.v1.DataClassificationSetting.DataClassificationConfig.classification:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.ClassificationEntry
+ 33, // 43: bytebase.v1.DataClassificationSetting.DataClassificationConfig.ClassificationEntry.value:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.DataClassification
+ 19, // 44: bytebase.v1.SemanticTypeSetting.SemanticType.algorithm:type_name -> bytebase.v1.Algorithm
+ 40, // 45: bytebase.v1.Algorithm.RangeMask.slices:type_name -> bytebase.v1.Algorithm.RangeMask.Slice
+ 4, // 46: bytebase.v1.Algorithm.InnerOuterMask.type:type_name -> bytebase.v1.Algorithm.InnerOuterMask.MaskType
+ 42, // 47: bytebase.v1.EnvironmentSetting.Environment.tags:type_name -> bytebase.v1.EnvironmentSetting.Environment.TagsEntry
+ 6, // 48: bytebase.v1.SettingService.ListSettings:input_type -> bytebase.v1.ListSettingsRequest
+ 8, // 49: bytebase.v1.SettingService.GetSetting:input_type -> bytebase.v1.GetSettingRequest
+ 10, // 50: bytebase.v1.SettingService.UpdateSetting:input_type -> bytebase.v1.UpdateSettingRequest
+ 7, // 51: bytebase.v1.SettingService.ListSettings:output_type -> bytebase.v1.ListSettingsResponse
+ 11, // 52: bytebase.v1.SettingService.GetSetting:output_type -> bytebase.v1.Setting
+ 11, // 53: bytebase.v1.SettingService.UpdateSetting:output_type -> bytebase.v1.Setting
+ 51, // [51:54] is the sub-list for method output_type
+ 48, // [48:51] is the sub-list for method input_type
+ 48, // [48:48] is the sub-list for extension type_name
+ 48, // [48:48] is the sub-list for extension extendee
+ 0, // [0:48] is the sub-list for field type_name
}
func init() { file_v1_setting_service_proto_init() }
diff --git a/backend/generated-go/v1/setting_service_equal.pb.go b/backend/generated-go/v1/setting_service_equal.pb.go
index e450bb3147..c4d5074e49 100644
--- a/backend/generated-go/v1/setting_service_equal.pb.go
+++ b/backend/generated-go/v1/setting_service_equal.pb.go
@@ -334,7 +334,10 @@ func (x *WorkspaceProfileSetting) Equal(y *WorkspaceProfileSetting) bool {
if x.Require_2Fa != y.Require_2Fa {
return false
}
- if p, q := x.TokenDuration, y.TokenDuration; (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {
+ if p, q := x.RefreshTokenDuration, y.RefreshTokenDuration; (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {
+ return false
+ }
+ if p, q := x.AccessTokenDuration, y.AccessTokenDuration; (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {
return false
}
if !x.Announcement.Equal(y.Announcement) {
diff --git a/backend/migrator/migration/3.14/0013##rename_token_duration_setting.sql b/backend/migrator/migration/3.14/0013##rename_token_duration_setting.sql
new file mode 100644
index 0000000000..a66e1e09bf
--- /dev/null
+++ b/backend/migrator/migration/3.14/0013##rename_token_duration_setting.sql
@@ -0,0 +1,9 @@
+-- Rename tokenDuration to refreshTokenDuration in WORKSPACE_PROFILE setting
+UPDATE setting
+SET value = jsonb_set(
+ value - 'tokenDuration',
+ '{refreshTokenDuration}',
+ value->'tokenDuration'
+)
+WHERE name = 'WORKSPACE_PROFILE'
+ AND value ? 'tokenDuration';
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index 3bf469a343..b95dbff4ac 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -12,8 +12,8 @@ import (
func TestLatestVersion(t *testing.T) {
files, err := getSortedVersionedFiles()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("3.14.12"), *files[len(files)-1].version)
- require.Equal(t, "migration/3.14/0012##plan_has_rollout_index.sql", files[len(files)-1].path)
+ require.Equal(t, semver.MustParse("3.14.13"), *files[len(files)-1].version)
+ require.Equal(t, "migration/3.14/0013##rename_token_duration_setting.sql", files[len(files)-1].path)
}
func TestVersionUnique(t *testing.T) {
diff --git a/docs/plans/2025-12-26-token-duration-settings-design.md b/docs/plans/2025-12-26-token-duration-settings-design.md
new file mode 100644
index 0000000000..c47fd41ecc
--- /dev/null
+++ b/docs/plans/2025-12-26-token-duration-settings-design.md
@@ -0,0 +1,90 @@
+# Token Duration Settings Design
+
+## Overview
+
+Add configurable settings for access token and refresh token durations in workspace settings.
+
+## Background
+
+Bytebase previously supported only "access tokens" which behaved like refresh tokens (long-lived, 7 days default). The existing `token_duration` setting and `FEATURE_SIGN_IN_FREQUENCY_CONTROL` feature flag are legacy naming from this era.
+
+This change properly separates token types with distinct settings:
+- **Access token**: Short-lived (1 hour default)
+- **Refresh token**: Long-lived (7 days default)
+
+## Design
+
+### Proto Changes
+
+**Store proto** (`proto/store/store/setting.proto`):
+```protobuf
+message WorkspaceProfileSetting {
+ // ... existing fields 1-3 ...
+
+ // RENAME: token_duration → refresh_token_duration (same field number 4)
+ google.protobuf.Duration refresh_token_duration = 4;
+
+ // NEW: access_token_duration
+ google.protobuf.Duration access_token_duration = 18;
+
+ // ... rest unchanged ...
+}
+```
+
+**V1 proto** (`proto/v1/v1/setting_service.proto`):
+- Same field renames in the API-facing `WorkspaceProfileSetting` message
+
+### Data Migration
+
+SQL migration to rename existing JSON key in stored settings:
+
+```sql
+UPDATE setting
+SET value = jsonb_set(
+ value - 'tokenDuration',
+ '{refreshTokenDuration}',
+ value->'tokenDuration'
+)
+WHERE name = 'WORKSPACE_PROFILE'
+ AND value ? 'tokenDuration';
+```
+
+### Backend Changes
+
+**`backend/api/auth/header.go`**:
+- Rename/refactor `GetTokenDuration()` → `GetAccessTokenDuration()`
+- Add `GetRefreshTokenDuration()` function
+- Both gated by `FEATURE_SIGN_IN_FREQUENCY_CONTROL`
+
+**`backend/api/v1/auth_service.go`**:
+- Update token generation to use appropriate duration functions
+- Refresh token creation uses `GetRefreshTokenDuration()`
+
+### Frontend Changes
+
+- Update locale files with new i18n keys
+- Update settings UI to show both duration fields
+- Rename existing field label, add new field
+
+### Defaults
+
+| Token Type | Default Duration |
+|------------|------------------|
+| Access Token | 1 hour |
+| Refresh Token | 7 days |
+
+### Constraints
+
+- No validation limits on durations - admins have full control
+- Feature gated by `FEATURE_SIGN_IN_FREQUENCY_CONTROL` (enterprise)
+
+## Implementation Steps
+
+1. Update store proto (`proto/store/store/setting.proto`)
+2. Update v1 proto (`proto/v1/v1/setting_service.proto`)
+3. Run `cd proto && buf generate`
+4. Add database migration for JSON key rename
+5. Update `backend/api/auth/header.go` with new duration functions
+6. Update `backend/api/v1/auth_service.go` to use new functions
+7. Update frontend locales
+8. Update frontend settings UI
diff --git a/docs/plans/2025-12-26-token-duration-settings.md b/docs/plans/2025-12-26-token-duration-settings.md
new file mode 100644
index 0000000000..7be1cde104
--- /dev/null
+++ b/docs/plans/2025-12-26-token-duration-settings.md
@@ -0,0 +1,661 @@
+# Token Duration Settings Implementation Plan
+
+> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
+
+**Goal:** Add separate configurable settings for access token and refresh token durations.
+
+**Architecture:** Rename legacy `token_duration` to `refresh_token_duration` (since old "access tokens" behaved as refresh tokens), add new `access_token_duration` field. Both gated by existing `FEATURE_SIGN_IN_FREQUENCY_CONTROL` feature flag.
+
+**Tech Stack:** Go, Protocol Buffers, Vue 3, TypeScript, PostgreSQL
+
+---
+
+## Task 1: Update Store Proto
+
+**Files:**
+- Modify: `proto/store/store/setting.proto:72-73`
+
+**Step 1: Rename token_duration and add access_token_duration**
+
+In `WorkspaceProfileSetting` message, change:
+
+```protobuf
+ // The duration for token.
+ google.protobuf.Duration token_duration = 4;
+```
+
+To:
+
+```protobuf
+ // The duration for refresh token. Default is 7 days.
+ google.protobuf.Duration refresh_token_duration = 4;
+
+ // The duration for access token. Default is 1 hour.
+ google.protobuf.Duration access_token_duration = 18;
+```
+
+---
+
+## Task 2: Update V1 Proto
+
+**Files:**
+- Modify: `proto/v1/v1/setting_service.proto:182-183`
+
+**Step 1: Rename token_duration and add access_token_duration**
+
+In `WorkspaceProfileSetting` message, change:
+
+```protobuf
+ // The duration for token.
+ google.protobuf.Duration token_duration = 4;
+```
+
+To:
+
+```protobuf
+ // The duration for refresh token. Default is 7 days.
+ google.protobuf.Duration refresh_token_duration = 4;
+
+ // The duration for access token. Default is 1 hour.
+ google.protobuf.Duration access_token_duration = 18;
+```
+
+---
+
+## Task 3: Format and Generate Protos
+
+**Step 1: Format protos**
+
+Run: `buf format -w proto`
+
+**Step 2: Generate code**
+
+Run: `cd proto && buf generate`
+
+---
+
+## Task 4: Add Database Migration
+
+**Files:**
+- Create: `backend/migrator/migration/3.14/0012##rename_token_duration_setting.sql`
+
+**Step 1: Create migration file**
+
+```sql
+-- Rename tokenDuration to refreshTokenDuration in WORKSPACE_PROFILE setting
+UPDATE setting
+SET value = jsonb_set(
+ value - 'tokenDuration',
+ '{refreshTokenDuration}',
+ value->'tokenDuration'
+)
+WHERE name = 'WORKSPACE_PROFILE'
+ AND value ? 'tokenDuration';
+```
+
+---
+
+## Task 5: Update Backend Auth Constants
+
+**Files:**
+- Modify: `backend/api/auth/auth.go:43-44`
+
+**Step 1: Rename constant**
+
+Change:
+
+```go
+ // DefaultTokenDuration is the default token expiration duration.
+ DefaultTokenDuration = 7 * 24 * time.Hour
+```
+
+To:
+
+```go
+ // DefaultAccessTokenDuration is the default access token expiration duration.
+ DefaultAccessTokenDuration = 1 * time.Hour
+ // DefaultRefreshTokenDuration is the default refresh token expiration duration.
+ DefaultRefreshTokenDuration = 7 * 24 * time.Hour
+```
+
+---
+
+## Task 6: Update Backend Header Functions
+
+**Files:**
+- Modify: `backend/api/auth/header.go`
+
+**Step 1: Rename GetTokenDuration to GetAccessTokenDuration**
+
+Replace the entire `GetTokenDuration` function (lines 44-74) with:
+
+```go
+func GetAccessTokenDuration(ctx context.Context, store *store.Store, licenseService *enterprise.LicenseService) time.Duration {
+ accessTokenDuration := DefaultAccessTokenDuration
+
+ // If the sign-in frequency control feature is not enabled, return default duration
+ if err := licenseService.IsFeatureEnabled(v1pb.PlanFeature_FEATURE_SIGN_IN_FREQUENCY_CONTROL); err != nil {
+ return accessTokenDuration
+ }
+
+ workspaceProfile, err := store.GetWorkspaceProfileSetting(ctx)
+ if err != nil {
+ return accessTokenDuration
+ }
+
+ if workspaceProfile.GetAccessTokenDuration().GetSeconds() > 0 {
+ accessTokenDuration = workspaceProfile.GetAccessTokenDuration().AsDuration()
+ }
+
+ return accessTokenDuration
+}
+
+func GetRefreshTokenDuration(ctx context.Context, store *store.Store, licenseService *enterprise.LicenseService) time.Duration {
+ refreshTokenDuration := DefaultRefreshTokenDuration
+
+ // If the sign-in frequency control feature is not enabled, return default duration
+ if err := licenseService.IsFeatureEnabled(v1pb.PlanFeature_FEATURE_SIGN_IN_FREQUENCY_CONTROL); err != nil {
+ return refreshTokenDuration
+ }
+
+ workspaceProfile, err := store.GetWorkspaceProfileSetting(ctx)
+ if err != nil {
+ return refreshTokenDuration
+ }
+
+ if workspaceProfile.GetRefreshTokenDuration().GetSeconds() > 0 {
+ refreshTokenDuration = workspaceProfile.GetRefreshTokenDuration().AsDuration()
+ }
+ // Currently we implement the password rotation restriction in a simple way:
+ // 1. Only check if users need to reset their password during login.
+ // 2. For the 1st time login, if `RequireResetPasswordForFirstLogin` is true, `require_reset_password` in the response will be true
+ // 3. Otherwise if the `PasswordRotation` exists, check the password last updated time to decide if the `require_reset_password` is true.
+ // So we will use the minimum value between (`refreshTokenDuration`, `passwordRestriction.PasswordRotation`) to force to expire the token.
+ passwordRestriction := workspaceProfile.GetPasswordRestriction()
+ if passwordRestriction.GetPasswordRotation().GetSeconds() > 0 {
+ passwordRotation := passwordRestriction.GetPasswordRotation().AsDuration()
+ if passwordRotation.Seconds() < refreshTokenDuration.Seconds() {
+ refreshTokenDuration = passwordRotation
+ }
+ }
+
+ return refreshTokenDuration
+}
+```
+
+**Step 2: Update GetTokenCookie to use new function**
+
+In `GetTokenCookie` function (line 25), change:
+
+```go
+ tokenDuration := GetTokenDuration(ctx, stores, licenseService)
+```
+
+To:
+
+```go
+ tokenDuration := GetAccessTokenDuration(ctx, stores, licenseService)
+```
+
+---
+
+## Task 7: Update Auth Service
+
+**Files:**
+- Modify: `backend/api/v1/auth_service.go`
+
+**Step 1: Remove placeholder GetRefreshTokenDuration**
+
+Delete lines 90-96 (the placeholder `GetRefreshTokenDuration` function):
+
+```go
+// GetRefreshTokenDuration returns the configured refresh token duration or default.
+func GetRefreshTokenDuration(_ context.Context, _ *store.Store, _ *enterprise.LicenseService) time.Duration {
+ // TODO: Add refresh_token_duration field to WorkspaceProfileSetting proto
+ // and implement workspace setting-based configuration similar to GetTokenDuration.
+ // For now, use a fixed 30-day duration.
+ return 30 * 24 * time.Hour
+}
+```
+
+**Step 2: Update generateLoginToken to use new function name**
+
+In `generateLoginToken` function (line 781), change:
+
+```go
+ tokenDuration := auth.GetTokenDuration(ctx, s.store, s.licenseService)
+```
+
+To:
+
+```go
+ tokenDuration := auth.GetAccessTokenDuration(ctx, s.store, s.licenseService)
+```
+
+**Step 3: Update Refresh method to use auth.GetRefreshTokenDuration**
+
+In `Refresh` method (line 265), change:
+
+```go
+ refreshTokenDuration := GetRefreshTokenDuration(ctx, s.store, s.licenseService)
+```
+
+To:
+
+```go
+ refreshTokenDuration := auth.GetRefreshTokenDuration(ctx, s.store, s.licenseService)
+```
+
+**Step 4: Update finalizeLogin to use auth.GetRefreshTokenDuration**
+
+In `finalizeLogin` method (line 813), change:
+
+```go
+ refreshTokenDuration := GetRefreshTokenDuration(ctx, s.store, s.licenseService)
+```
+
+To:
+
+```go
+ refreshTokenDuration := auth.GetRefreshTokenDuration(ctx, s.store, s.licenseService)
+```
+
+---
+
+## Task 8: Update Frontend Types
+
+**Files:**
+- Modify: `frontend/src/types/setting.ts`
+
+**Step 1: Add access token duration constant**
+
+Change:
+
+```typescript
+export const defaultTokenDurationInHours = 7 * 24;
+```
+
+To:
+
+```typescript
+export const defaultAccessTokenDurationInHours = 1;
+export const defaultRefreshTokenDurationInHours = 7 * 24;
+```
+
+---
+
+## Task 9: Update Frontend Component
+
+**Files:**
+- Modify: `frontend/src/components/GeneralSetting/SignInFrequencySetting.vue`
+
+**Step 1: Update import**
+
+Change:
+
+```typescript
+import { defaultTokenDurationInHours } from "@/types";
+```
+
+To:
+
+```typescript
+import { defaultAccessTokenDurationInHours, defaultRefreshTokenDurationInHours } from "@/types";
+```
+
+**Step 2: Update LocalState interface**
+
+Change:
+
+```typescript
+interface LocalState {
+ tokenDuration: number;
+ inactiveTimeout: number;
+ timeFormat: "HOURS" | "DAYS";
+ showFeatureModal: boolean;
+}
+```
+
+To:
+
+```typescript
+interface LocalState {
+ accessTokenDuration: number;
+ accessTokenTimeFormat: "MINUTES" | "HOURS";
+ refreshTokenDuration: number;
+ refreshTokenTimeFormat: "HOURS" | "DAYS";
+ inactiveTimeout: number;
+ showFeatureModal: boolean;
+}
+```
+
+**Step 3: Update getInitialState function**
+
+Replace the `getInitialState` function with:
+
+```typescript
+const getInitialState = (): LocalState => {
+ const defaultState: LocalState = {
+ accessTokenDuration: defaultAccessTokenDurationInHours * 60,
+ accessTokenTimeFormat: "MINUTES",
+ refreshTokenDuration: defaultRefreshTokenDurationInHours / 24,
+ refreshTokenTimeFormat: "DAYS",
+ inactiveTimeout: -1,
+ showFeatureModal: false,
+ };
+
+ // Access token duration
+ const accessTokenSeconds = settingV1Store.workspaceProfileSetting
+ ?.accessTokenDuration?.seconds
+ ? Number(settingV1Store.workspaceProfileSetting.accessTokenDuration.seconds)
+ : undefined;
+ if (accessTokenSeconds && accessTokenSeconds > 0) {
+ if (accessTokenSeconds < 60 * 60) {
+ defaultState.accessTokenDuration = Math.floor(accessTokenSeconds / 60) || 1;
+ defaultState.accessTokenTimeFormat = "MINUTES";
+ } else {
+ defaultState.accessTokenDuration = Math.floor(accessTokenSeconds / (60 * 60)) || 1;
+ defaultState.accessTokenTimeFormat = "HOURS";
+ }
+ }
+
+ // Refresh token duration
+ const refreshTokenSeconds = settingV1Store.workspaceProfileSetting
+ ?.refreshTokenDuration?.seconds
+ ? Number(settingV1Store.workspaceProfileSetting.refreshTokenDuration.seconds)
+ : undefined;
+ if (refreshTokenSeconds && refreshTokenSeconds > 0) {
+ if (refreshTokenSeconds < 60 * 60 * 24) {
+ defaultState.refreshTokenDuration = Math.floor(refreshTokenSeconds / (60 * 60)) || 1;
+ defaultState.refreshTokenTimeFormat = "HOURS";
+ } else {
+ defaultState.refreshTokenDuration = Math.floor(refreshTokenSeconds / (60 * 60 * 24)) || 1;
+ defaultState.refreshTokenTimeFormat = "DAYS";
+ }
+ }
+
+ // Inactive timeout
+ const inactiveTimeoutSeconds = Number(
+ settingV1Store.workspaceProfileSetting?.inactiveSessionTimeout?.seconds ?? 0
+ );
+ if (inactiveTimeoutSeconds) {
+ defaultState.inactiveTimeout = Math.floor(inactiveTimeoutSeconds / (60 * 60)) || 0;
+ }
+
+ return defaultState;
+};
+```
+
+**Step 4: Add handlers for new settings**
+
+Add after `handleInactivityTimeoutSettingChange`:
+
+```typescript
+const handleAccessTokenDurationChange = async () => {
+ const seconds =
+ state.accessTokenTimeFormat === "MINUTES"
+ ? state.accessTokenDuration * 60
+ : state.accessTokenDuration * 60 * 60;
+ await settingV1Store.updateWorkspaceProfile({
+ payload: {
+ accessTokenDuration: create(DurationSchema, {
+ seconds: BigInt(seconds),
+ nanos: 0,
+ }),
+ },
+ updateMask: create(FieldMaskSchema, {
+ paths: ["value.workspace_profile.access_token_duration"],
+ }),
+ });
+};
+
+const handleRefreshTokenDurationChange = async () => {
+ const seconds =
+ state.refreshTokenTimeFormat === "HOURS"
+ ? state.refreshTokenDuration * 60 * 60
+ : state.refreshTokenDuration * 24 * 60 * 60;
+ await settingV1Store.updateWorkspaceProfile({
+ payload: {
+ refreshTokenDuration: create(DurationSchema, {
+ seconds: BigInt(seconds),
+ nanos: 0,
+ }),
+ },
+ updateMask: create(FieldMaskSchema, {
+ paths: ["value.workspace_profile.refresh_token_duration"],
+ }),
+ });
+};
+```
+
+**Step 5: Update handleUpdate function**
+
+Replace `handleUpdate` with:
+
+```typescript
+const handleUpdate = async () => {
+ const initState = getInitialState();
+
+ if (initState.inactiveTimeout !== state.inactiveTimeout) {
+ await handleInactivityTimeoutSettingChange();
+ }
+
+ if (
+ initState.accessTokenDuration !== state.accessTokenDuration ||
+ initState.accessTokenTimeFormat !== state.accessTokenTimeFormat
+ ) {
+ await handleAccessTokenDurationChange();
+ }
+
+ if (
+ initState.refreshTokenDuration !== state.refreshTokenDuration ||
+ initState.refreshTokenTimeFormat !== state.refreshTokenTimeFormat
+ ) {
+ await handleRefreshTokenDurationChange();
+ }
+};
+```
+
+**Step 6: Update watch for time format constraints**
+
+Replace the watch with:
+
+```typescript
+watch(
+ () => [state.accessTokenTimeFormat],
+ () => {
+ if (state.accessTokenTimeFormat === "MINUTES" && state.accessTokenDuration > 59) {
+ state.accessTokenDuration = 59;
+ }
+ }
+);
+
+watch(
+ () => [state.refreshTokenTimeFormat],
+ () => {
+ if (state.refreshTokenTimeFormat === "HOURS" && state.refreshTokenDuration > 23) {
+ state.refreshTokenDuration = 23;
+ }
+ }
+);
+```
+
+**Step 7: Delete handleFrequencySettingChange function**
+
+Remove the old `handleFrequencySettingChange` function (no longer needed).
+
+**Step 8: Update template**
+
+Replace the first `<div class="mb-7 mt-4 lg:mt-0">` block (lines 2-42) with:
+
+```vue
+ <!-- Access Token Duration -->
+ <div class="mb-7 mt-4 lg:mt-0" @click="handleValueFieldClick">
+ <p class="font-medium flex flex-row justify-start items-center">
+ <span class="mr-2">{{
+ $t("settings.general.workspace.access-token-duration.self")
+ }}</span>
+ <FeatureBadge :feature="PlanFeature.FEATURE_SIGN_IN_FREQUENCY_CONTROL" />
+ </p>
+ <p class="text-sm text-gray-400 mt-1">
+ {{ $t("settings.general.workspace.access-token-duration.description") }}
+ </p>
+ <NTooltip placement="top-start" :disabled="allowChangeSetting">
+ <template #trigger>
+ <div class="mt-3 w-full flex flex-row justify-start items-center">
+ <NInputNumber
+ v-model:value="state.accessTokenDuration"
+ class="w-24 mr-4"
+ :disabled="!allowChangeSetting"
+ :min="1"
+ :max="state.accessTokenTimeFormat === 'MINUTES' ? 59 : 23"
+ :precision="0"
+ />
+ <NRadioGroup
+ v-model:value="state.accessTokenTimeFormat"
+ :disabled="!allowChangeSetting"
+ >
+ <NRadio
+ :value="'MINUTES'"
+ :label="$t('settings.general.workspace.access-token-duration.minutes')"
+ />
+ <NRadio
+ :value="'HOURS'"
+ :label="$t('settings.general.workspace.access-token-duration.hours')"
+ />
+ </NRadioGroup>
+ </div>
+ </template>
+ <span class="text-sm text-gray-400 -translate-y-2">
+ {{ $t("settings.general.workspace.only-admin-can-edit") }}
+ </span>
+ </NTooltip>
+ </div>
+
+ <!-- Refresh Token Duration -->
+ <div class="mb-7 mt-4 lg:mt-0" @click="handleValueFieldClick">
+ <p class="font-medium flex flex-row justify-start items-center">
+ <span class="mr-2">{{
+ $t("settings.general.workspace.refresh-token-duration.self")
+ }}</span>
+ <FeatureBadge :feature="PlanFeature.FEATURE_SIGN_IN_FREQUENCY_CONTROL" />
+ </p>
+ <p class="text-sm text-gray-400 mt-1">
+ {{ $t("settings.general.workspace.refresh-token-duration.description") }}
+ </p>
+ <NTooltip placement="top-start" :disabled="allowChangeSetting">
+ <template #trigger>
+ <div class="mt-3 w-full flex flex-row justify-start items-center">
+ <NInputNumber
+ v-model:value="state.refreshTokenDuration"
+ class="w-24 mr-4"
+ :disabled="!allowChangeSetting"
+ :min="1"
+ :max="state.refreshTokenTimeFormat === 'HOURS' ? 23 : undefined"
+ :precision="0"
+ />
+ <NRadioGroup
+ v-model:value="state.refreshTokenTimeFormat"
+ :disabled="!allowChangeSetting"
+ >
+ <NRadio
+ :value="'HOURS'"
+ :label="$t('settings.general.workspace.refresh-token-duration.hours')"
+ />
+ <NRadio
+ :value="'DAYS'"
+ :label="$t('settings.general.workspace.refresh-token-duration.days')"
+ />
+ </NRadioGroup>
+ </div>
+ </template>
+ <span class="text-sm text-gray-400 -translate-y-2">
+ {{ $t("settings.general.workspace.only-admin-can-edit") }}
+ </span>
+ </NTooltip>
+ </div>
+```
+
+---
+
+## Task 10: Update Locale Files
+
+**Files:**
+- Modify: `frontend/src/locales/en-US.json`
+- Modify: `frontend/src/locales/zh-CN.json`
+- Modify: `frontend/src/locales/ja-JP.json`
+- Modify: `frontend/src/locales/es-ES.json`
+- Modify: `frontend/src/locales/vi-VN.json`
+
+**Step 1: Update en-US.json**
+
+Replace the `"sign-in-frequency"` section (around line 704) with:
+
+```json
+ "access-token-duration": {
+ "self": "Access token duration",
+ "description": "How long access tokens remain valid before requiring refresh. Shorter durations improve security.",
+ "minutes": "Minute(s)",
+ "hours": "Hour(s)"
+ },
+ "refresh-token-duration": {
+ "self": "Refresh token duration",
+ "description": "How often users must fully reauthenticate. Configuration updates require users to sign in again for changes to take effect.",
+ "hours": "Hour(s)",
+ "days": "Day(s)"
+ },
+```
+
+**Step 2: Update zh-CN.json**
+
+Replace the `"sign-in-frequency"` section with:
+
+```json
+ "access-token-duration": {
+ "self": "访问令牌有效期",
+ "description": "访问令牌在需要刷新前保持有效的时间。较短的有效期可提高安全性。",
+ "minutes": "分钟",
+ "hours": "小时"
+ },
+ "refresh-token-duration": {
+ "self": "刷新令牌有效期",
+ "description": "用户需要完全重新认证的频率。配置更新后需要用户重新登录才能生效。",
+ "hours": "小时",
+ "days": "天"
+ },
+```
+
+**Step 3: Update other locale files similarly**
+
+For `ja-JP.json`, `es-ES.json`, `vi-VN.json` - replace the `"sign-in-frequency"` section with equivalent `"access-token-duration"` and `"refresh-token-duration"` sections (can use English as placeholder if translations not immediately available).
+
+---
+
+## Task 11: Build and Lint
+
+**Step 1: Format Go code**
+
+Run: `gofmt -w backend/api/auth/auth.go backend/api/auth/header.go backend/api/v1/auth_service.go`
+
+**Step 2: Run Go linter**
+
+Run: `golangci-lint run --allow-parallel-runners`
+
+Fix any issues reported.
+
+**Step 3: Run frontend checks**
+
+Run: `pnpm --dir frontend biome:check`
+Run: `pnpm --dir frontend type-check`
+
+---
+
+## Task 12: Commit Changes
+
+**Step 1: Check status**
+
+Run: `but status`
+
+**Step 2: Commit**
+
+Run: `but commit token-duration-settings -m "feat(auth): add separate access and refresh token duration settings"`
diff --git a/frontend/src/components/GeneralSetting/SignInFrequencySetting.vue b/frontend/src/components/GeneralSetting/SignInFrequencySetting.vue
index 7a08307675..ab9b80e4da 100644
--- a/frontend/src/components/GeneralSetting/SignInFrequencySetting.vue
+++ b/frontend/src/components/GeneralSetting/SignInFrequencySetting.vue
@@ -1,36 +1,80 @@
<template>
+ <!-- Access Token Duration -->
<div class="mb-7 mt-4 lg:mt-0" @click="handleValueFieldClick">
<p class="font-medium flex flex-row justify-start items-center">
<span class="mr-2">{{
- $t("settings.general.workspace.sign-in-frequency.self")
+ $t("settings.general.workspace.access-token-duration.self")
}}</span>
<FeatureBadge :feature="PlanFeature.FEATURE_SIGN_IN_FREQUENCY_CONTROL" />
</p>
<p class="text-sm text-gray-400 mt-1">
- {{ $t("settings.general.workspace.sign-in-frequency.description") }}
+ {{ $t("settings.general.workspace.access-token-duration.description") }}
</p>
<NTooltip placement="top-start" :disabled="allowChangeSetting">
<template #trigger>
<div class="mt-3 w-full flex flex-row justify-start items-center">
<NInputNumber
- v-model:value="state.tokenDuration"
+ v-model:value="state.accessTokenDuration"
class="w-24 mr-4"
:disabled="!allowChangeSetting"
:min="1"
- :max="state.timeFormat === 'HOURS' ? 23 : undefined"
+ :max="state.accessTokenTimeFormat === 'MINUTES' ? 59 : 23"
:precision="0"
/>
<NRadioGroup
- v-model:value="state.timeFormat"
+ v-model:value="state.accessTokenTimeFormat"
+ :disabled="!allowChangeSetting"
+ >
+ <NRadio
+ :value="'MINUTES'"
+ :label="$t('settings.general.workspace.access-token-duration.minutes')"
+ />
+ <NRadio
+ :value="'HOURS'"
+ :label="$t('settings.general.workspace.access-token-duration.hours')"
+ />
+ </NRadioGroup>
+ </div>
+ </template>
+ <span class="text-sm text-gray-400 -translate-y-2">
+ {{ $t("settings.general.workspace.only-admin-can-edit") }}
+ </span>
+ </NTooltip>
+ </div>
+
+ <!-- Refresh Token Duration -->
+ <div class="mb-7 mt-4 lg:mt-0" @click="handleValueFieldClick">
+ <p class="font-medium flex flex-row justify-start items-center">
+ <span class="mr-2">{{
+ $t("settings.general.workspace.refresh-token-duration.self")
+ }}</span>
+ <FeatureBadge :feature="PlanFeature.FEATURE_SIGN_IN_FREQUENCY_CONTROL" />
+ </p>
+ <p class="text-sm text-gray-400 mt-1">
+ {{ $t("settings.general.workspace.refresh-token-duration.description") }}
+ </p>
+ <NTooltip placement="top-start" :disabled="allowChangeSetting">
+ <template #trigger>
+ <div class="mt-3 w-full flex flex-row justify-start items-center">
+ <NInputNumber
+ v-model:value="state.refreshTokenDuration"
+ class="w-24 mr-4"
+ :disabled="!allowChangeSetting"
+ :min="1"
+ :max="state.refreshTokenTimeFormat === 'HOURS' ? 23 : undefined"
+ :precision="0"
+ />
+ <NRadioGroup
+ v-model:value="state.refreshTokenTimeFormat"
:disabled="!allowChangeSetting"
>
<NRadio
:value="'HOURS'"
- :label="$t('settings.general.workspace.sign-in-frequency.hours')"
+ :label="$t('settings.general.workspace.refresh-token-duration.hours')"
/>
<NRadio
:value="'DAYS'"
- :label="$t('settings.general.workspace.sign-in-frequency.days')"
+ :label="$t('settings.general.workspace.refresh-token-duration.days')"
/>
</NRadioGroup>
</div>
@@ -94,39 +138,68 @@ import { computed, reactive, watch } from "vue";
import { FeatureBadge, FeatureModal } from "@/components/FeatureGuard";
import { featureToRef } from "@/store";
import { useSettingV1Store } from "@/store/modules/v1/setting";
-import { defaultTokenDurationInHours } from "@/types";
+import {
+ defaultAccessTokenDurationInHours,
+ defaultRefreshTokenDurationInHours,
+} from "@/types";
import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";
interface LocalState {
- tokenDuration: number;
+ accessTokenDuration: number;
+ accessTokenTimeFormat: "MINUTES" | "HOURS";
+ refreshTokenDuration: number;
+ refreshTokenTimeFormat: "HOURS" | "DAYS";
inactiveTimeout: number;
- timeFormat: "HOURS" | "DAYS";
showFeatureModal: boolean;
}
const getInitialState = (): LocalState => {
const defaultState: LocalState = {
- tokenDuration: defaultTokenDurationInHours / 24,
+ accessTokenDuration: defaultAccessTokenDurationInHours * 60,
+ accessTokenTimeFormat: "MINUTES",
+ refreshTokenDuration: defaultRefreshTokenDurationInHours / 24,
+ refreshTokenTimeFormat: "DAYS",
inactiveTimeout: -1,
- timeFormat: "DAYS",
showFeatureModal: false,
};
- const tokenDurationSeconds = settingV1Store.workspaceProfileSetting
- ?.tokenDuration?.seconds
- ? Number(settingV1Store.workspaceProfileSetting.tokenDuration.seconds)
+
+ // Access token duration
+ const accessTokenSeconds = settingV1Store.workspaceProfileSetting
+ ?.accessTokenDuration?.seconds
+ ? Number(settingV1Store.workspaceProfileSetting.accessTokenDuration.seconds)
+ : undefined;
+ if (accessTokenSeconds && accessTokenSeconds > 0) {
+ if (accessTokenSeconds < 60 * 60) {
+ defaultState.accessTokenDuration =
+ Math.floor(accessTokenSeconds / 60) || 1;
+ defaultState.accessTokenTimeFormat = "MINUTES";
+ } else {
+ defaultState.accessTokenDuration =
+ Math.floor(accessTokenSeconds / (60 * 60)) || 1;
+ defaultState.accessTokenTimeFormat = "HOURS";
+ }
+ }
+
+ // Refresh token duration
+ const refreshTokenSeconds = settingV1Store.workspaceProfileSetting
+ ?.refreshTokenDuration?.seconds
+ ? Number(
+ settingV1Store.workspaceProfileSetting.refreshTokenDuration.seconds
+ )
: undefined;
- if (tokenDurationSeconds && tokenDurationSeconds > 0) {
- if (tokenDurationSeconds < 60 * 60 * 24) {
- defaultState.tokenDuration =
- Math.floor(tokenDurationSeconds / (60 * 60)) || 1;
- defaultState.timeFormat = "HOURS";
+ if (refreshTokenSeconds && refreshTokenSeconds > 0) {
+ if (refreshTokenSeconds < 60 * 60 * 24) {
+ defaultState.refreshTokenDuration =
+ Math.floor(refreshTokenSeconds / (60 * 60)) || 1;
+ defaultState.refreshTokenTimeFormat = "HOURS";
} else {
- defaultState.tokenDuration =
- Math.floor(tokenDurationSeconds / (60 * 60 * 24)) || 1;
- defaultState.timeFormat = "DAYS";
+ defaultState.refreshTokenDuration =
+ Math.floor(refreshTokenSeconds / (60 * 60 * 24)) || 1;
+ defaultState.refreshTokenTimeFormat = "DAYS";
}
}
+ // Inactive timeout
const inactiveTimeoutSeconds = Number(
settingV1Store.workspaceProfileSetting?.inactiveSessionTimeout?.seconds ?? 0
);
@@ -134,6 +207,7 @@ const getInitialState = (): LocalState => {
defaultState.inactiveTimeout =
Math.floor(inactiveTimeoutSeconds / (60 * 60)) || 0;
}
+
return defaultState;
};
@@ -159,57 +233,98 @@ const handleValueFieldClick = () => {
}
};
-const handleFrequencySettingChange = async () => {
+const handleInactivityTimeoutSettingChange = async () => {
+ await settingV1Store.updateWorkspaceProfile({
+ payload: {
+ inactiveSessionTimeout: create(DurationSchema, {
+ seconds: BigInt(state.inactiveTimeout * 60 * 60),
+ nanos: 0,
+ }),
+ },
+ updateMask: create(FieldMaskSchema, {
+ paths: ["value.workspace_profile.inactive_session_timeout"],
+ }),
+ });
+};
+
+const handleAccessTokenDurationChange = async () => {
const seconds =
- state.timeFormat === "HOURS"
- ? state.tokenDuration * 60 * 60
- : state.tokenDuration * 24 * 60 * 60;
+ state.accessTokenTimeFormat === "MINUTES"
+ ? state.accessTokenDuration * 60
+ : state.accessTokenDuration * 60 * 60;
await settingV1Store.updateWorkspaceProfile({
payload: {
- tokenDuration: create(DurationSchema, {
+ accessTokenDuration: create(DurationSchema, {
seconds: BigInt(seconds),
nanos: 0,
}),
},
updateMask: create(FieldMaskSchema, {
- paths: ["value.workspace_profile.token_duration"],
+ paths: ["value.workspace_profile.access_token_duration"],
}),
});
};
-const handleInactivityTimeoutSettingChange = async () => {
+const handleRefreshTokenDurationChange = async () => {
+ const seconds =
+ state.refreshTokenTimeFormat === "HOURS"
+ ? state.refreshTokenDuration * 60 * 60
+ : state.refreshTokenDuration * 24 * 60 * 60;
await settingV1Store.updateWorkspaceProfile({
payload: {
- inactiveSessionTimeout: create(DurationSchema, {
- seconds: BigInt(state.inactiveTimeout * 60 * 60),
+ refreshTokenDuration: create(DurationSchema, {
+ seconds: BigInt(seconds),
nanos: 0,
}),
},
updateMask: create(FieldMaskSchema, {
- paths: ["value.workspace_profile.inactive_session_timeout"],
+ paths: ["value.workspace_profile.refresh_token_duration"],
}),
});
};
const handleUpdate = async () => {
const initState = getInitialState();
+
if (initState.inactiveTimeout !== state.inactiveTimeout) {
await handleInactivityTimeoutSettingChange();
}
if (
- initState.tokenDuration !== state.tokenDuration ||
- initState.timeFormat !== state.timeFormat
+ initState.accessTokenDuration !== state.accessTokenDuration ||
+ initState.accessTokenTimeFormat !== state.accessTokenTimeFormat
+ ) {
+ await handleAccessTokenDurationChange();
+ }
+
+ if (
+ initState.refreshTokenDuration !== state.refreshTokenDuration ||
+ initState.refreshTokenTimeFormat !== state.refreshTokenTimeFormat
) {
- await handleFrequencySettingChange();
+ await handleRefreshTokenDurationChange();
}
};
watch(
- () => [state.timeFormat],
+ () => [state.accessTokenTimeFormat],
+ () => {
+ if (
+ state.accessTokenTimeFormat === "MINUTES" &&
+ state.accessTokenDuration > 59
+ ) {
+ state.accessTokenDuration = 59;
+ }
+ }
+);
+
+watch(
+ () => [state.refreshTokenTimeFormat],
() => {
- if (state.timeFormat === "HOURS" && state.tokenDuration > 23) {
- state.tokenDuration = 23;
+ if (
+ state.refreshTokenTimeFormat === "HOURS" &&
+ state.refreshTokenDuration > 23
+ ) {
+ state.refreshTokenDuration = 23;
}
}
);
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 7ea8ede89a..5eb044faff 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -701,9 +701,15 @@
"managed-by-flag": "This setting is managed via the --external-url command-line flag",
"cannot-edit-flag": "External URL cannot be changed because it is set via --external-url command-line flag"
},
- "sign-in-frequency": {
- "self": "Sign-in frequency",
- "description": "Sign-in frequency defines how often users must reauthenticate. Configuration updates require users to sign in again for changes to take effect.",
+ "access-token-duration": {
+ "self": "Access token duration",
+ "description": "How long access tokens remain valid before requiring refresh. Shorter durations improve security.",
+ "minutes": "Minute(s)",
+ "hours": "Hour(s)"
+ },
+ "refresh-token-duration": {
+ "self": "Refresh token duration",
+ "description": "How often users must fully reauthenticate. Configuration updates require users to sign in again for changes to take effect.",
"hours": "Hour(s)",
"days": "Day(s)"
},
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 9a8f07310b..9b72e3e0e9 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -701,11 +701,17 @@
"managed-by-flag": "Esta configuración está gestionada a través del parámetro de línea de comandos --external-url",
"cannot-edit-flag": "La URL externa no se puede cambiar porque está configurada mediante el parámetro de línea de comandos --external-url"
},
- "sign-in-frequency": {
- "self": "Frecuencia de inicio de sesión",
- "description": "La frecuencia de inicio de sesión define con qué frecuencia los usuarios deben volver a autenticarse. Las actualizaciones de configuración requieren que los usuarios inicien sesión nuevamente para que los cambios surtan efecto.",
- "hours": "Horas",
- "days": "Días"
+ "access-token-duration": {
+ "self": "Access token duration",
+ "description": "How long access tokens remain valid before requiring refresh. Shorter durations improve security.",
+ "minutes": "Minute(s)",
+ "hours": "Hour(s)"
+ },
+ "refresh-token-duration": {
+ "self": "Refresh token duration",
+ "description": "How often users must fully reauthenticate. Configuration updates require users to sign in again for changes to take effect.",
+ "hours": "Hour(s)",
+ "days": "Day(s)"
},
"inactive-session-timeout": {
"self": "Tiempo de espera de sesión inactiva",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 4fc72569fe..7c406cfb4c 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -701,11 +701,17 @@
"managed-by-flag": "この設定は --external-url コマンドラインフラグによって管理されています",
"cannot-edit-flag": "外部URLは --external-url コマンドラインフラグで設定されているため変更できません"
},
- "sign-in-frequency": {
- "self": "ログイン頻度",
- "description": "サインイン頻度は、ユーザーが再認証する必要がある間隔を定義します。設定の更新は、変更を反映させるためにユーザーが再度サインインする必要があります。",
- "hours": "時間",
- "days": "日"
+ "access-token-duration": {
+ "self": "Access token duration",
+ "description": "How long access tokens remain valid before requiring refresh. Shorter durations improve security.",
+ "minutes": "Minute(s)",
+ "hours": "Hour(s)"
+ },
+ "refresh-token-duration": {
+ "self": "Refresh token duration",
+ "description": "How often users must fully reauthenticate. Configuration updates require users to sign in again for changes to take effect.",
+ "hours": "Hour(s)",
+ "days": "Day(s)"
},
"inactive-session-timeout": {
"self": "非アクティブセッションタイムアウト",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 7d4b04061f..317fbe2325 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -701,11 +701,17 @@
"managed-by-flag": "Cài đặt này được quản lý thông qua tham số dòng lệnh --external-url",
"cannot-edit-flag": "Không thể thay đổi URL bên ngoài vì nó được đặt thông qua tham số dòng lệnh --external-url"
},
- "sign-in-frequency": {
- "self": "Tần suất đăng nhập",
- "description": "Tần suất đăng nhập xác định tần suất người dùng phải xác thực lại. Cập nhật cấu hình yêu cầu người dùng đăng nhập lại để thay đổi có hiệu lực.",
- "hours": "Giờ",
- "days": "Ngày"
+ "access-token-duration": {
+ "self": "Access token duration",
+ "description": "How long access tokens remain valid before requiring refresh. Shorter durations improve security.",
+ "minutes": "Minute(s)",
+ "hours": "Hour(s)"
+ },
+ "refresh-token-duration": {
+ "self": "Refresh token duration",
+ "description": "How often users must fully reauthenticate. Configuration updates require users to sign in again for changes to take effect.",
+ "hours": "Hour(s)",
+ "days": "Day(s)"
},
"inactive-session-timeout": {
"self": "Thời gian chờ phiên không hoạt động",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index db50945688..6cfd130437 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -701,11 +701,17 @@
"managed-by-flag": "此设置由 --external-url 命令行参数管理",
"cannot-edit-flag": "外部 URL 无法更改,因为它是通过 --external-url 命令行参数设置的"
},
- "sign-in-frequency": {
- "self": "登录频率",
- "description": "登录频率定义了用户需要重新验证身份的时间间隔。配置更新需要用户重新登录才能生效。",
+ "access-token-duration": {
+ "self": "访问令牌有效期",
+ "description": "访问令牌在需要刷新前保持有效的时间。较短的有效期可提高安全性。",
+ "minutes": "分钟",
+ "hours": "小时"
+ },
+ "refresh-token-duration": {
+ "self": "刷新令牌有效期",
+ "description": "用户需要完全重新认证的频率。配置更新后需要用户重新登录才能生效。",
"hours": "小时",
- "days": "天数"
+ "days": "天"
},
"inactive-session-timeout": {
"self": "非活动会话超时",
diff --git a/frontend/src/types/proto-es/v1/setting_service_pb.d.ts b/frontend/src/types/proto-es/v1/setting_service_pb.d.ts
index f53cb7f288..7d8714de82 100644
--- a/frontend/src/types/proto-es/v1/setting_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/setting_service_pb.d.ts
@@ -500,11 +500,18 @@ export declare type WorkspaceProfileSetting = Message<"bytebase.v1.WorkspaceProf
require2fa: boolean;
/**
- * The duration for token.
+ * The duration for refresh token. Default is 7 days.
*
- * @generated from field: google.protobuf.Duration token_duration = 4;
+ * @generated from field: google.protobuf.Duration refresh_token_duration = 4;
*/
- tokenDuration?: Duration;
+ refreshTokenDuration?: Duration;
+
+ /**
+ * The duration for access token. Default is 1 hour.
+ *
+ * @generated from field: google.protobuf.Duration access_token_duration = 18;
+ */
+ accessTokenDuration?: Duration;
/**
* The setting of custom announcement
diff --git a/frontend/src/types/proto-es/v1/setting_service_pb.js b/frontend/src/types/proto-es/v1/setting_service_pb.js
index 4e8422129d..33420bff81 100644
--- a/frontend/src/types/proto-es/v1/setting_service_pb.js
+++ b/frontend/src/types/proto-es/v1/setting_service_pb.js
@@ -17,7 +17,7 @@ import { file_v1_issue_service } from "./issue_service_pb";
* Describes the file v1/setting_service.proto.
*/
export const file_v1_setting_service = /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rgMKDlNldHRpbmdTZXJ2aWNlEoQBCgxMaXN0U2V0dGluZ3MSIC5ieXRlYmFzZS52MS5MaXN0U2V0dGluZ3NSZXF1ZXN0GiEuYnl0ZWJhc2UudjEuTGlzdFNldHRpbmdzUmVzcG9uc2UiL9pBAIrqMBBiYi5zZXR0aW5ncy5saXN0kOowAYLT5JMCDhIML3YxL3NldHRpbmdzEn8KCkdldFNldHRpbmcSHi5ieXRlYmFzZS52MS5HZXRTZXR0aW5nUmVxdWVzdBoULmJ5dGViYXNlLnYxLlNldHRpbmciO9pBBG5hbWWK6jAPYmIuc2V0dGluZ3MuZ2V0kOowAYLT5JMCFxIVL3YxL3tuYW1lPXNldHRpbmdzLyp9EpMBCg1VcGRhdGVTZXR0aW5nEiEuYnl0ZWJhc2UudjEuVXBkYXRlU2V0dGluZ1JlcXVlc3QaFC5ieXRlYmFzZS52MS5TZXR0aW5nIkmK6jAPYmIuc2V0dGluZ3Muc2V0kOowAZjqMAGC0+STAig6B3NldHRpbmcyHS92MS97c2V0dGluZy5uYW1lPXNldHRpbmdzLyp9QqkBCg9jb20uYnl0ZWJhc2UudjFCE1NldHRpbmdTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_field_mask, file_google_type_expr, file_v1_annotation, file_v1_common, file_v1_issue_service]);
+ fileDesc("Chh2MS9zZXR0aW5nX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIhUKE0xpc3RTZXR0aW5nc1JlcXVlc3QiPgoUTGlzdFNldHRpbmdzUmVzcG9uc2USJgoIc2V0dGlu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XRlYmFzZS52MS5MaXN0U2V0dGluZ3NSZXF1ZXN0GiEuYnl0ZWJhc2UudjEuTGlzdFNldHRpbmdzUmVzcG9uc2UiL9pBAIrqMBBiYi5zZXR0aW5ncy5saXN0kOowAYLT5JMCDhIML3YxL3NldHRpbmdzEn8KCkdldFNldHRpbmcSHi5ieXRlYmFzZS52MS5HZXRTZXR0aW5nUmVxdWVzdBoULmJ5dGViYXNlLnYxLlNldHRpbmciO9pBBG5hbWWK6jAPYmIuc2V0dGluZ3MuZ2V0kOowAYLT5JMCFxIVL3YxL3tuYW1lPXNldHRpbmdzLyp9EpMBCg1VcGRhdGVTZXR0aW5nEiEuYnl0ZWJhc2UudjEuVXBkYXRlU2V0dGluZ1JlcXVlc3QaFC5ieXRlYmFzZS52MS5TZXR0aW5nIkmK6jAPYmIuc2V0dGluZ3Muc2V0kOowAZjqMAGC0+STAig6B3NldHRpbmcyHS92MS97c2V0dGluZy5uYW1lPXNldHRpbmdzLyp9QqkBCg9jb20uYnl0ZWJhc2UudjFCE1NldHRpbmdTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_field_mask, file_google_type_expr, file_v1_annotation, file_v1_common, file_v1_issue_service]);
/**
* Describes the message bytebase.v1.ListSettingsRequest.
diff --git a/frontend/src/types/setting.ts b/frontend/src/types/setting.ts
index 1d89781e0c..2107ea1d59 100644
--- a/frontend/src/types/setting.ts
+++ b/frontend/src/types/setting.ts
@@ -1 +1,2 @@
-export const defaultTokenDurationInHours = 7 * 24;
+export const defaultAccessTokenDurationInHours = 1;
+export const defaultRefreshTokenDurationInHours = 7 * 24;
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 586b1cf34c..c293681364 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -15182,10 +15182,14 @@ components:
require2fa:
type: boolean
description: Require 2FA for all users.
- tokenDuration:
+ refreshTokenDuration:
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
type: string
- description: The duration for token.
+ description: The duration for refresh token. Default is 7 days.
+ accessTokenDuration:
+ pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
+ type: string
+ description: The duration for access token. Default is 1 hour.
announcement:
allOf:
- $ref: '#/components/schemas/Announcement'
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 8f5d805535..19748c0be1 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -4502,7 +4502,8 @@ The severity level for SQL review rules.
| external_url | [string](#string) | | The external URL is used for sso authentication callback. |
| disallow_signup | [bool](#bool) | | Disallow self-service signup, users can only be invited by the owner. |
| require_2fa | [bool](#bool) | | Require 2FA for all users. |
-| token_duration | [google.protobuf.Duration](#google-protobuf-Duration) | | The duration for token. |
+| refresh_token_duration | [google.protobuf.Duration](#google-protobuf-Duration) | | The duration for refresh token. Default is 7 days. |
+| access_token_duration | [google.protobuf.Duration](#google-protobuf-Duration) | | The duration for access token. Default is 1 hour. |
| announcement | [WorkspaceProfileSetting.Announcement](#bytebase-store-WorkspaceProfileSetting-Announcement) | | The setting of custom announcement |
| maximum_role_expiration | [google.protobuf.Duration](#google-protobuf-Duration) | | The max duration for role expired. |
| domains | [string](#string) | repeated | The workspace domain, e.g., bytebase.com. |
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index 5758679bce..1d5326062a 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -12233,10 +12233,17 @@ are /[a-z][0-9]-/. </p></td>
</tr>
<tr>
- <td>token_duration</td>
+ <td>refresh_token_duration</td>
<td><a href="#google.protobuf.Duration">google.protobuf.Duration</a></td>
<td></td>
- <td><p>The duration for token. </p></td>
+ <td><p>The duration for refresh token. Default is 7 days. </p></td>
+ </tr>
+
+ <tr>
+ <td>access_token_duration</td>
+ <td><a href="#google.protobuf.Duration">google.protobuf.Duration</a></td>
+ <td></td>
+ <td><p>The duration for access token. Default is 1 hour. </p></td>
</tr>
<tr>
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 11fb76394b..3bf2d1013b 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -2062,7 +2062,8 @@ For examples: resource.environment_id == &#34;prod&#34; &amp;&amp; statement.aff
| external_url | [string](#string) | | The external URL is used for sso authentication callback. |
| disallow_signup | [bool](#bool) | | Disallow self-service signup, users can only be invited by the owner. |
| require_2fa | [bool](#bool) | | Require 2FA for all users. |
-| token_duration | [google.protobuf.Duration](#google-protobuf-Duration) | | The duration for token. |
+| refresh_token_duration | [google.protobuf.Duration](#google-protobuf-Duration) | | The duration for refresh token. Default is 7 days. |
+| access_token_duration | [google.protobuf.Duration](#google-protobuf-Duration) | | The duration for access token. Default is 1 hour. |
| announcement | [Announcement](#bytebase-v1-Announcement) | | The setting of custom announcement |
| maximum_role_expiration | [google.protobuf.Duration](#google-protobuf-Duration) | | The max duration for role expired. |
| domains | [string](#string) | repeated | The workspace domain, e.g., bytebase.com. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 7108729f78..5666801f63 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -6179,10 +6179,17 @@ resource.table_name.matches(&#34;sensitive_.*&#34;) &amp;&amp; resource.db_engin
</tr>
<tr>
- <td>token_duration</td>
+ <td>refresh_token_duration</td>
<td><a href="#google.protobuf.Duration">google.protobuf.Duration</a></td>
<td></td>
- <td><p>The duration for token. </p></td>
+ <td><p>The duration for refresh token. Default is 7 days. </p></td>
+ </tr>
+
+ <tr>
+ <td>access_token_duration</td>
+ <td><a href="#google.protobuf.Duration">google.protobuf.Duration</a></td>
+ <td></td>
+ <td><p>The duration for access token. Default is 1 hour. </p></td>
</tr>
<tr>
diff --git a/proto/store/store/setting.proto b/proto/store/store/setting.proto
index dfeb964de9..affcd4f5d8 100644
--- a/proto/store/store/setting.proto
+++ b/proto/store/store/setting.proto
@@ -69,8 +69,11 @@ message WorkspaceProfileSetting {
// Require 2FA for all users.
bool require_2fa = 3;
- // The duration for token.
- google.protobuf.Duration token_duration = 4;
+ // The duration for refresh token. Default is 7 days.
+ google.protobuf.Duration refresh_token_duration = 4;
+
+ // The duration for access token. Default is 1 hour.
+ google.protobuf.Duration access_token_duration = 18;
// The setting of custom announcement
Announcement announcement = 5;
diff --git a/proto/v1/v1/setting_service.proto b/proto/v1/v1/setting_service.proto
index ee80a3ca63..d4d1d28f5c 100644
--- a/proto/v1/v1/setting_service.proto
+++ b/proto/v1/v1/setting_service.proto
@@ -179,8 +179,11 @@ message WorkspaceProfileSetting {
// Require 2FA for all users.
bool require_2fa = 3;
- // The duration for token.
- google.protobuf.Duration token_duration = 4;
+ // The duration for refresh token. Default is 7 days.
+ google.protobuf.Duration refresh_token_duration = 4;
+
+ // The duration for access token. Default is 1 hour.
+ google.protobuf.Duration access_token_duration = 18;
// The setting of custom announcement
Announcement announcement = 5;