pomerium/internal
Kenneth Jenkins 6a24b01d28 identity: preserve session refresh schedule
The databroker identity manager is responsible for refreshing session
records, to account for overall session expiration as well as OAuth2
access token expiration.

Refresh events are scheduled subject to a coolOffDuration (10 seconds,
by default) relative to a lastRefresh timestamp. Currently, any update
to a session record will reset the associated lastRefresh value and
reschedule any pending refresh event for that session. If an update
occurs close before a scheduled refresh event, this will push back the
scheduled refresh event to 10 seconds from that time.

This means that if a session is updated frequently enough (e.g. if there
is a steady stream of requests that cause constant updates via the
AccessTracker), the access token may expire before a refresh ever runs.

To avoid this problem, do not update the lastRefresh time upon every
session record update, but only if it hasn't yet been set. Instead,
update the lastRefresh during the refresh attempt itself.

Add unit tests to exercise these changes. There is a now() function as
part of the manager configuration (to allow unit tests to set a fake
time); update the Manager to use this function throughout.
2023-10-24 14:15:53 -07:00
..
atomicutil atomicutil: use atomicutil.Value wherever possible (#3517) 2022-07-28 15:38:38 -06:00
autocert autocert: use new OCSP error type (#4437) 2023-08-04 14:41:25 -07:00
chanutil fileutil: update watcher to use fsnotify and polling (#3663) 2022-10-19 09:13:08 -06:00
contextkeys xds: only tag contexts used for UpdateRecords (#2269) 2021-06-04 14:01:25 -04:00
controlplane logs: add ip address to access logs (#4391) 2023-08-09 07:09:00 -06:00
databroker config: update logic for checking overlapping certificates (#4216) 2023-06-01 09:30:46 -06:00
deterministicecdsa config: remove source, remove deadcode, fix linting issues (#4118) 2023-04-21 17:25:11 -06:00
encoding config: remove source, remove deadcode, fix linting issues (#4118) 2023-04-21 17:25:11 -06:00
events events: remove xds configuraton update (#3792) 2022-12-06 14:46:45 -05:00
fileutil auto tls (#3856) 2023-01-05 16:35:58 -05:00
handlers core/authenticate: refactor idp sign out (#4582) 2023-09-28 08:41:19 -07:00
hashutil dev: update linter (#1728) 2020-12-30 09:02:57 -08:00
httputil proxy: add support for logging http request headers (#4388) 2023-07-25 09:46:42 -06:00
identity identity: preserve session refresh schedule 2023-10-24 14:15:53 -07:00
log logs: add ip address to access logs (#4391) 2023-08-09 07:09:00 -06:00
middleware controlplane: remove gorilla handlers dependency (#3813) 2022-12-15 14:41:29 -07:00
redisutil chore(deps): bump github.com/golangci/golangci-lint from 1.48.0 to 1.50.0 (#3667) 2022-10-19 09:36:59 -06:00
registry config: remove source, remove deadcode, fix linting issues (#4118) 2023-04-21 17:25:11 -06:00
scheduler feature/databroker: user data and session refactor project (#926) 2020-06-19 07:52:44 -06:00
sessions config: add cookie_same_site option (#4148) 2023-05-03 14:36:42 -06:00
sets Fix typos (#3575) 2022-08-30 15:51:40 -07:00
signal log context (#2107) 2021-04-22 10:58:13 -04:00
syncutil config: generate cookie secret if not set in all-in-one mode (#3742) 2022-11-11 14:14:30 -07:00
telemetry Add metric request error in log (#4585) 2023-09-21 15:29:35 -06:00
tests/xdserr config: remove source, remove deadcode, fix linting issues (#4118) 2023-04-21 17:25:11 -06:00
testutil authorize: incorporate mTLS validation from Envoy (#4374) 2023-07-21 12:17:01 -07:00
tripper config: remove source, remove deadcode, fix linting issues (#4118) 2023-04-21 17:25:11 -06:00
urlutil stub out HPKE public key fetch for self-hosted authenticate (#4360) 2023-07-13 10:04:34 -07:00
version dev: update linter (#1728) 2020-12-30 09:02:57 -08:00