Allow fixing the redirect_url when authenticating requests with different hostnames - #99
Closed
Thanhphan1147 wants to merge 5 commits into
Closed
Allow fixing the redirect_url when authenticating requests with different hostnames#99Thanhphan1147 wants to merge 5 commits into
Thanhphan1147 wants to merge 5 commits into
Conversation
…ple protected hostnames
…vice_multiple_domains Add oidc_callback_host to allow using a single redirect_url for multiple protected hostnames
Author
|
Hi @mougams, can you take a look at this PR when you have the time? I'm happy to discuss about it or provide more context if needed! |
Contributor
Hi @Thanhphan1147 - thank you for your patch. Could you please also update the test, mostly in tests/oidc_authentication_test.go. Thx! |
Author
|
After thinking about it a bit, there are quite a few security implications with this PR, mainly about storing the original URL in the state as well as third-party cookies. I'm closing the PR for now, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the behavior of the oidc authenticator is that:
example.comis sent to the agent, it will use the hostname to fetch the OIDC client from the statically defined config or register a new one under that hostname ifarg_{client_id, client_secret, redirect_url}.example.com/oauth2/callback.example.comto set the cookie on the client brower.While this is fine for single hostname, when haproxy is serving incoming request with a lot of different hostnames the list of allowed redirect URLs that needs to be configured will need to be updated constantly on the IDP side which is not ideal. Some IDPs also only allow one set of credential per redirect URL.
This PR tries to provide a solution for cases like that where the redirect URL can be set to a fixed value regardless of the hostname of the incoming request. The client's original destination is now embeded into the state and used in the final redirect to set the client cookie. The flow now will be something like this: