-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implement refreshing within OIDC provider #620
Conversation
fd5dcc4
to
98e1eb3
Compare
Probably should have mentioned that I also built an image 😅 We have a branch at Pusher (https://github.com/pusher/oauth2_proxy/tree/kubernetes) that I'm maintaining which has all of my PRs in (#464, #534, #620) and I've published an image on quay: We are now running all three PRs in production and I've been testing locally with Dex/OAuth Proxy with 1-minute tokens. |
Nice. I checked my merged branch against yours and see some minor variation, not sure if there's a change missing somewhere. For some reason I can't get a good diff view in github, so I'm uploading a patch here, just wanted to run by you in case it means something is missing from one of the PRs? |
@jhohertz I added a commit to the end of #464 to add some documentation which you are missing, You're also using the copy of this branch And the final change is a line I never meant to commit that I... err... erased from history (I'm bad, I know 😆) If I were you I would just take the |
@JoelSpeed : Thanks for taking the time to explain. Now on a build from your kubernetes branch, will let you know if I run into any issues. |
@JoelSpeed I seem to be having issues with refresh, though I suspect it may be a bad configuration on my part vs. a problem w/ the code. From the logs (w/ token/email obfuscated):
I have dex (with your google PRs) running as the oidc provider. My guess is one of the url params of the proxy I am not setting is required for this? (redeem? unsure what the right endpoint on dex for this would be) |
@jhohertz just to double check, do you have And also what timings have you got for the |
I do have
For Dex... it looks like I must be using defaults, as I am not setting any timeout values in my config. I will have a look. |
@jhohertz I've been having a look at this and have found the problem. If you don't actually need to refresh, the The default To fix this (properly) I could override the The alternative that I have come up with is a bit of a cheeky hack, Replacing the start of
But not without the verification step if not using #534 Any maintainers around to weigh in on this? I think I might create a branch that does this properly, but I may have to merge #534 and #620 into a bigger OIDC rewrite PR |
An alternative quick fix is to make sure your |
Allows tokens to be refreshed within the OIDC provider.
This means that users will no longer have to re-authenticate when the ID Token expires but instead the OAuth proxy will refresh automatically in the background.
Make sure to add
offline_access
to the requestscope
when using this (else you won't request a refresh token from the upstream provider).I'd also recommend setting the
cookie_refresh
parameter to the same duration as your token lifetime.Can be used in conjunction with #534 using the branch https://github.com/pusher/oauth2_proxy/tree/oidc-refresh