-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
OAuth 2 proxy never initiates a login after the cookie has expired
Expected Behavior
oauth 2 proxy should initate a login flow flow after --cookie-refresh time has passed
Current Behavior
oauth 2 proxy never initiates the login based on the cookie-refresh value, it's only after a refresh of the access token fails, that it initiates a login
Steps to Reproduce
Setup:
oauth2 proxy: OIDC provider for Keycloak
- cookie-refresh = 30s
- cookie-expire = 1m30s
The oauth2 proxy is configured to serve some static file for a mock backend.
We were constantly refreshing our browser to perform the test.
The Keycloak configuration is irrelevant as oauth2-proxy only cares about the cookie.
Context
In our real world setup, we have a Keycloak setup where the access token lifetime is 5m, and the refresh token lifetime is 10h.
This is my understanding of how oauth2 proxy works
- the --cookie-refresh parameter controls after how long oauth2-proxy will request a new access token using the refresh token
- the --cookie-expire parameter controls after how long oauth2-proxy will invalidate its cookie, thus invalidating both refresh and access token and requiring a user login
With this information, we set --cookie-refresh to 4m30s, and --cookie-expire to 9h54m, because in our understanding this
should make it so the oauth2 proxy never forwards tokens that are about to expire.
This does not seem to be the case as we still see users reaching our backend with expired tokens.
Your Environment
- Version used: 7.3.0