[feat] Add httpLookupAuthAllowRedirect option to forward auth credentials on HTTP lookup redirects#588
Open
geniusjoe wants to merge 1 commit into
Open
Conversation
…ials on HTTP lookup redirects
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.
Master Issue: #313
Motivation
When using HTTP-based lookup service with authentication enabled, the broker may respond with an HTTP redirect (3xx) to the correct owner broker if the initial broker is not the owner of the requested topic. However, by default, libcurl strips the
Authorizationheader on cross-origin redirects for security reasons. This causes the redirected request to fail with a401 Unauthorizederror on the target broker.This PR introduces a new client configuration option
httpLookupAuthAllowRedirectto allow forwarding authentication credentials when following HTTP lookup redirects.Modifications
setHttpLookupAuthAllowRedirect/isHttpLookupAuthAllowRedirectmethods toClientConfiguration(C++ and C API).httpLookupAuthAllowRedirectfield toClientConfigurationImpl.authAllowRedirectoption toCurlWrapper::Options, which setsCURLOPT_UNRESTRICTED_AUTHwhen enabled.ClientConfigurationthroughHTTPLookupServicetoCurlWrapperduring HTTP lookup requests.Verifying this change
This change is already covered by existing tests, such as:
tests/c/c_ClientConfigurationTest.ccto verify the C API getter/setter forhttpLookupAuthAllowRedirect(default value, set to true, set back to false).Documentation
doc-not-needed(The new configuration option is self-documented via its API doc comments in
ClientConfiguration.h. No external documentation update is required.)Workflow test
geniusjoe#1