[fix][broker] Continue using the next provider for http authentication if one fails - #23842
Merged
Conversation
…n if one fails Signed-off-by: Zixuan Liu <nodeces@gmail.com>
poorbarcode
pushed a commit
to poorbarcode/pulsar
that referenced
this pull request
Jan 23, 2025
…n if one fails (apache#23842) Signed-off-by: Zixuan Liu <nodeces@gmail.com>
nikhil-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Jan 31, 2025
…n if one fails (apache#23842) Signed-off-by: Zixuan Liu <nodeces@gmail.com> (cherry picked from commit f1f65a5) Signed-off-by: Zixuan Liu <nodeces@gmail.com> (cherry picked from commit 8181177)
srinath-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Feb 3, 2025
…n if one fails (apache#23842) Signed-off-by: Zixuan Liu <nodeces@gmail.com> (cherry picked from commit f1f65a5) Signed-off-by: Zixuan Liu <nodeces@gmail.com> (cherry picked from commit 8181177)
hanmz
pushed a commit
to hanmz/pulsar
that referenced
this pull request
Feb 12, 2025
…n if one fails (apache#23842) Signed-off-by: Zixuan Liu <nodeces@gmail.com>
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.
Motivation
When using Pulsar admin version 2.10.x with JWT authentication and a broker running 3.0.x (forked from Apache Pulsar) configured with both Kerberos and JWT authentication providers, we encounter the following issue:
When a request is without the authentication method name in the HTTP header(#14044 improves that), the broker iterates through each authentication provider to authenticate the request, if authentication data is valid, the broker acts on the request. In this scenario, I ensured that the JWT provider was configured correctly and the token was valid. However, I still encountered an authentication error.
The root cause is that the
org.apache.pulsar.broker.authentication.AuthenticationService#authenticateHttpRequest(javax.servlet.http.HttpServletRequest, org.apache.pulsar.broker.authentication.AuthenticationDataSource)andorg.apache.pulsar.broker.authentication.AuthenticationService#authenticateHttpRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)only catches theAuthenticationExecption, if one provider throws an exception of a different type, the authentication process will be terminated.Related to #23797, which fixes the pulsar chain authentication, not HTTP authentication.
Modifications
LinkedHashMapinstead ofHasMapfor provider ordering.Exception, which can catch any exceptions.Documentation
docdoc-requireddoc-not-neededdoc-complete