diff --git a/docs/sessions.md b/docs/sessions.md index 0428b78..f546d6c 100644 --- a/docs/sessions.md +++ b/docs/sessions.md @@ -36,7 +36,7 @@ If you've configured a session lifetime that is longer than the token expiry, yo The behaviour for refreshing depends on the [runtime mode](configuration.md#modes) for Wonderwall. In standalone mode, tokens are automatically refreshed. -Tokens will at the _earliest_ automatically be renewed 5 minutes before they expire. +Tokens will at the _earliest_ automatically be renewed 30 seconds before they expire. If the token already _has_ expired, a refresh attempt is still automatically triggered as long as the session itself not has ended or is marked as inactive. Automatic refreshes happens whenever the end-user visits or requests any path that is proxied to the upstream application. diff --git a/pkg/session/data.go b/pkg/session/data.go index 9633329..690bbd4 100644 --- a/pkg/session/data.go +++ b/pkg/session/data.go @@ -14,7 +14,7 @@ import ( const ( RefreshMinInterval = 1 * time.Minute - RefreshLeeway = 5 * time.Minute + RefreshLeeway = 30 * time.Second ) type EncryptedData struct { diff --git a/pkg/session/data_test.go b/pkg/session/data_test.go index 66d0595..4d7d74e 100644 --- a/pkg/session/data_test.go +++ b/pkg/session/data_test.go @@ -195,7 +195,7 @@ func TestMetadata_ShouldRefresh(t *testing.T) { metadata := session.Metadata{ Tokens: session.MetadataTokens{ RefreshedAt: time.Now().Add(-5 * time.Minute), - ExpireAt: time.Now().Add(time.Minute), + ExpireAt: time.Now().Add(15 * time.Second), }, } @@ -273,7 +273,7 @@ func TestMetadata_ShouldRefresh(t *testing.T) { }, Tokens: session.MetadataTokens{ RefreshedAt: time.Now().Add(-5 * time.Minute), - ExpireAt: time.Now().Add(time.Minute), + ExpireAt: time.Now().Add(15 * time.Second), }, }