-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[improve][authentication] Pass the authorization when user lookup transactionCoordinator topic #22744
base: master
Are you sure you want to change the base?
[improve][authentication] Pass the authorization when user lookup transactionCoordinator topic #22744
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
import org.apache.pulsar.broker.authentication.AuthenticationDataSource; | ||
import org.apache.pulsar.broker.resources.PulsarResources; | ||
import org.apache.pulsar.common.naming.NamespaceName; | ||
import org.apache.pulsar.common.naming.SystemTopicNames; | ||
import org.apache.pulsar.common.naming.TopicName; | ||
import org.apache.pulsar.common.policies.data.AuthAction; | ||
import org.apache.pulsar.common.policies.data.AuthPolicies; | ||
|
@@ -155,6 +156,9 @@ public CompletableFuture<Boolean> canConsumeAsync(TopicName topicName, String ro | |
@Override | ||
public CompletableFuture<Boolean> canLookupAsync(TopicName topicName, String role, | ||
AuthenticationDataSource authenticationData) { | ||
if (SystemTopicNames.isTransactionCoordinatorAssign(topicName)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how do we control user can use transaction? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to restrict user to use transaction feature by authorizing the lookup permission of TC system topic? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just a thought, as we currently have no means to restrict users from using transactions. |
||
return CompletableFuture.completedFuture(true); | ||
} | ||
return canProduceAsync(topicName, role, authenticationData) | ||
.thenCompose(canProduce -> { | ||
if (canProduce) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should write this code in the
org.apache.pulsar.broker.authentication.AuthenticationService
.That looks like an important change, could you discuss this in the mailing list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should we implement it in
AuthenticationService
?