oauth2-proxy/pkg/middleware
Kinfemichael Desse 70be1b2893 feat: make session refresh timeouts user configurable
Make the session refresh lock duration, obtain timeout, and retry period
configurable via command-line flags, config file, or environment variables.

Previously, these values were hardcoded constants:
- sessionRefreshLockDuration = 2s
- sessionRefreshObtainTimeout = 5s
- sessionRefreshRetryPeriod = 10ms

This change removes the hardcoded constants and adds three new configuration
options to the Cookie configuration:
- `--session-refresh-lock-duration` (default: 2s)
- `--session-refresh-obtain-timeout` (default: 5s)
- `--session-refresh-retry-period` (default: 10ms)

The new options allow users to tune session refresh behavior for their
specific deployment requirements, such as:
- High-latency networks requiring longer timeouts
- High-throughput systems needing faster retry intervals
- Provider-specific refresh operation durations

Changes:
- Added SessionRefreshLockDuration, SessionRefreshObtainTimeout, and
  SessionRefreshRetryPeriod fields to Cookie struct
- Updated StoredSessionLoaderOptions to accept these as parameters
- Modified storedSessionLoader to use configurable values instead of constants
- Updated all tests to provide default values
- Maintains full backward compatibility with original default values

Resolves TODO comments in pkg/middleware/stored_session.go

Signed-off-by: Kinfemichael Desse <kinfemichael.desse@real-digital.de>
2026-02-11 15:10:13 +01:00
..
testdata/metrics Add Prometheus metrics endpoint 2021-02-15 13:45:26 +00:00
basic_session.go fix(1356): test if session variable is null (#1357) 2021-09-09 12:12:29 +01:00
basic_session_test.go chore(deps): Updated to ginkgo v2 (#2459) 2024-07-18 22:41:02 +02:00
headers.go feat: migrate google used organization id and header normalization booleans to pointers 2025-11-16 22:39:01 +01:00
headers_test.go feat: migrate google used organization id and header normalization booleans to pointers 2025-11-16 22:39:01 +01:00
healthcheck.go (#649) Remove blank helthcheck user agents and paths when setting up the healthcheck middleware 2020-07-06 14:07:38 +12:00
healthcheck_test.go chore(deps): Updated to ginkgo v2 (#2459) 2024-07-18 22:41:02 +02:00
jwt_session.go Add --bearer-token-login-fallback option (#2924) 2025-04-21 13:40:39 +01:00
jwt_session_test.go adapting unit tests and fixing minor issues introduced with the derefing 2025-11-16 22:38:57 +01:00
metrics.go Add Prometheus metrics endpoint 2021-02-15 13:45:26 +00:00
metrics_test.go chore(deps): Updated to ginkgo v2 (#2459) 2024-07-18 22:41:02 +02:00
middleware_suite_test.go chore(deps): Updated to ginkgo v2 (#2459) 2024-07-18 22:41:02 +02:00
readynesscheck.go feat: readiness check (#1839) 2022-12-23 09:08:12 +00:00
readynesscheck_test.go chore(deps): Updated to ginkgo v2 (#2459) 2024-07-18 22:41:02 +02:00
redirect_to_https.go Make HTTPS Redirect middleware Reverse Proxy aware 2021-01-16 13:55:48 -08:00
redirect_to_https_test.go chore(deps): Updated to ginkgo v2 (#2459) 2024-07-18 22:41:02 +02:00
request_logger.go Move Logging to Middleware Package (#1070) 2021-03-06 17:27:16 +00:00
request_logger_test.go chore(deps): Updated to ginkgo v2 (#2459) 2024-07-18 22:41:02 +02:00
scope.go Request ID Logging (#1087) 2021-03-21 18:20:57 +00:00
scope_test.go chore(deps): Updated to ginkgo v2 (#2459) 2024-07-18 22:41:02 +02:00
session_utils.go Add Basic Auth session loader middleware 2020-07-19 17:21:42 +01:00
session_utils_test.go chore(deps): Updated to ginkgo v2 (#2459) 2024-07-18 22:41:02 +02:00
stored_session.go feat: make session refresh timeouts user configurable 2026-02-11 15:10:13 +01:00
stored_session_test.go feat: make session refresh timeouts user configurable 2026-02-11 15:10:13 +01:00