Skip to content

Commit e8f2fc6

Browse files
authored
fix: update refresh token TTL to 7 days (#1585)
* fix: update refresh token TTL to 30 days * feat: add refresh token TTL config and reduce ttl
1 parent 85d80a6 commit e8f2fc6

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

pkg/auth/api/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ type options struct {
6060
}
6161

6262
var defaultOptions = options{
63-
refreshTokenTTL: time.Hour,
63+
refreshTokenTTL: 7 * 24 * time.Hour,
6464
logger: zap.NewNop(),
6565
}
6666

pkg/web/cmd/server/server.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ type server struct {
126126
autoOpsService *string
127127
codeReferenceService *string
128128
// auth
129+
refreshTokenTTL *time.Duration
129130
emailFilter *string
130131
oauthConfigPath *string
131132
oauthPublicKeyPath *string
@@ -287,6 +288,10 @@ func RegisterCommand(r cli.CommandRegistry, p cli.ParentCommand) cli.Command {
287288
"Path to public key used to verify oauth token.",
288289
).Required().String(),
289290
// auth
291+
refreshTokenTTL: cmd.Flag(
292+
"refresh-token-ttl",
293+
"TTL for refresh token.",
294+
).Default("168h").Duration(),
290295
emailFilter: cmd.Flag("email-filter", "Regexp pattern for filtering email.").String(),
291296
oauthConfigPath: cmd.Flag("oauth-config-path", "Path to oauth config.").Required().String(),
292297
oauthPrivateKeyPath: cmd.Flag(
@@ -825,6 +830,7 @@ func (s *server) createAuthService(
825830
}
826831
serviceOptions := []authapi.Option{
827832
authapi.WithLogger(logger),
833+
authapi.WithRefreshTokenTTL(*s.refreshTokenTTL),
828834
}
829835
if *s.emailFilter != "" {
830836
filter, err := regexp.Compile(*s.emailFilter)

0 commit comments

Comments
 (0)