[fix][broker] Fix token expiration - #16016
Merged
Merged
Conversation
nodece
force-pushed
the
fix-token-expiration
branch
from
June 11, 2022 04:50
265d2fb to
ef237ab
Compare
Member
Author
|
/pulsarbot rerun-failure-checks |
Contributor
There was a problem hiding this comment.
RobertIndie
reviewed
Jun 13, 2022
Member
Author
|
@codelipenghui @RobertIndie Thanks for your review! These request changes have been fixed, could you review this PR again? |
Member
Author
|
/pulsarbot rerun-failure-checks |
codelipenghui
approved these changes
Jun 13, 2022
Signed-off-by: Zixuan Liu <nodeces@gmail.com>
nodece
force-pushed
the
fix-token-expiration
branch
from
June 14, 2022 10:14
8e7686e to
5da0d10
Compare
Member
Author
|
@codelipenghui The authenticate logic has been update. |
RobertIndie
approved these changes
Jun 14, 2022
michaeljmarshall
approved these changes
Jun 15, 2022
michaeljmarshall
left a comment
Member
There was a problem hiding this comment.
LGTM. Great catch @nodece! I'm glad we didn't cherry pick #14044 when it was merged since it would be live now.
For additional context, I had mistakenly approved this specific change, and here is a link to my justification: #14044 (comment). This change technically means that clients authenticate the token twice on the initial connection, but only once on token refreshes.
codelipenghui
approved these changes
Jun 15, 2022
michaeljmarshall
pushed a commit
to michaeljmarshall/pulsar
that referenced
this pull request
Apr 19, 2023
### Motivation When token expiration, the broker requests the client to refresh the token, then the broker performs `org.apache.pulsar.broker.service.ServerCnx#doAuthentication` when the broker receives the auth response, which uses `org.apache.pulsar.broker.authentication.AuthenticationState#authenticate` to authentication, but the `org.apache.pulsar.broker.authentication.AuthenticationProviderToken.TokenAuthenticationState#authenticate` doesn't do anything, this cause a loop to refresh the token. Right now the token is only validated in the TokenAuthenticationState constructor, we need to add a check to the authenticate method. (cherry picked from commit 7576c93)
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.
Signed-off-by: Zixuan Liu nodeces@gmail.com
Motivation
When token expiration, the broker requests the client to refresh the token, then the broker performs
org.apache.pulsar.broker.service.ServerCnx#doAuthenticationwhen the broker receives the auth response, which usesorg.apache.pulsar.broker.authentication.AuthenticationState#authenticateto authentication, but theorg.apache.pulsar.broker.authentication.AuthenticationProviderToken.TokenAuthenticationState#authenticatedoesn't do anything, this cause a loop to refresh the token.Right now the token is only validated in the TokenAuthenticationState constructor, we need to add a check to the authenticate method.
Modifications
Documentation
doc-not-neededFix