Commit Graph
15 Commits
Author SHA1 Message Date
Francesco Pasqualini 2e1261c4be fix: invalidate session on fatal OAuth2 refresh errors (#3333)
* fix: invalidate session on fatal OAuth2 refresh errors

When a token refresh fails with a fatal OAuth2 error (invalid_grant,
invalid_client), the session is now cleared from the session store
and the cookie is removed, forcing re-authentication.

Previously, fatal refresh errors were logged but the stale session
continued to be served, leaving users logged in indefinitely after
their session was revoked at the provider level.

Transient errors (network timeouts, server errors) continue to
preserve the existing session as before.

Fixes #1945

Signed-off-by: Francesco Pasqualini <frapas@gmail.com>

* fix: apply review nits and add CHANGELOG entry

Signed-off-by: Francesco Pasqualini <frapas@gmail.com>
Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Francesco Pasqualini <frapas@gmail.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
2026-04-12 14:48:55 +02:00
Yosri BarhoumiandJan Larwig e2682f7595 fix: improve logging when session refresh token is missing (#3327)
* Improve logging for session refresh token status

Signed-off-by: Yosri Barhoumi <med.yosri.brh@gmail.com>

* doc: add changelog entry for #3327

Signed-off-by: Jan Larwig <jan@larwig.com>

* test: fix existing test cases for new behaviour

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Yosri Barhoumi <med.yosri.brh@gmail.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2026-03-23 10:54:32 +01:00
Teko f9a0a4a280 doc: fix typo in function description (#2738) 2024-08-20 18:41:23 +02:00
Joel Speed 54d42c5829 Implement refresh relying on obtaining lock 2022-02-16 10:16:13 +00:00
Kevin Kreitner e2c7ff6ddd Use session to lock to protect concurrent refreshes 2022-02-16 10:16:12 +00:00
Joel Speed d8deaa124b Improve error message when no cookie is found 2021-10-13 19:08:11 +01:00
Nick Meves ff914d7e17 Use ErrNotImplemented in default refresh implementation 2021-06-22 17:04:42 -07:00
Nick Meves 593125152d Standarize provider refresh implemention & logging 2021-06-22 17:04:30 -07:00
Nick Meves 7fa6d2d024 Manage session time fields centrally 2021-06-21 21:54:52 -07:00
Nick Meves 7e80e5596b RefreshSessions immediately when called 2021-06-21 21:54:52 -07:00
Nick Meves 6fb3274ca3 Refactor organization of scope aware request utils
Reorganized the structure of the Request Utils due to their widespread use
resulting in circular imports issues (mostly because of middleware & logger).
2021-01-16 13:55:48 -08:00
Mitsuo HeijoandJoel Speed 3fa42edb73 Fix import path for v7 (#800)
* fix import path for v7

find ./ -name "*.go" | xargs sed -i -e 's|"github.com/oauth2-proxy/oauth2-proxy|"github.com/oauth2-proxy/oauth2-proxy/v7|'

* fix module path

* go mod tidy

* fix installation docs

* update CHANGELOG

* Update CHANGELOG.md

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-09-29 17:44:42 +01:00
Phil TaproggeandJoel Speed d69fd6af22 Allow Logging to stdout with separate Error Log Channel (#718)
* Add dedicated error logging writer

* Document new errors to stdout flag

* Update changelog

* Thread-safe the log buffer

* Address feedback

* Remove duplication by adding log level

* Clean up error formatting

* Apply suggestions from code review

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-08-10 11:44:08 +01:00
Nick Meves 65c228394f Address gosec findings
Mostly handling unhandled errors appropriately.
If logging to STDERR fails, we panic. Added #nosec
comments to findings we are OK with.
2020-08-09 07:55:39 -07:00
Joel Speed 034f057b60 Add session loader from session storage 2020-07-19 17:21:42 +01:00