You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by eo...@apache.org on 2021/08/27 07:14:29 UTC
[pulsar] branch master updated: [Broker] Remove unnecessary futures;
fix comment (#11776)
This is an automated email from the ASF dual-hosted git repository.
eolivelli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new f32527f [Broker] Remove unnecessary futures; fix comment (#11776)
f32527f is described below
commit f32527fd02f386262a526ce45d4c51c28f073b14
Author: Michael Marshall <mi...@datastax.com>
AuthorDate: Fri Aug 27 02:12:50 2021 -0500
[Broker] Remove unnecessary futures; fix comment (#11776)
---
.../org/apache/pulsar/broker/service/ServerCnx.java | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
index 7d02e6a..c848362 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
@@ -382,8 +382,6 @@ public class ServerCnx extends PulsarHandler implements TransportCnx {
private CompletableFuture<Boolean> isTopicOperationAllowed(TopicName topicName, String subscriptionName,
TopicOperation operation) {
- CompletableFuture<Boolean> isProxyAuthorizedFuture;
- CompletableFuture<Boolean> isAuthorizedFuture;
if (service.isAuthorizationEnabled()) {
if (authenticationData == null) {
authenticationData = new AuthenticationDataCommand("", subscriptionName);
@@ -395,20 +393,8 @@ public class ServerCnx extends PulsarHandler implements TransportCnx {
}
return isTopicOperationAllowed(topicName, operation);
} else {
- isProxyAuthorizedFuture = CompletableFuture.completedFuture(true);
- isAuthorizedFuture = CompletableFuture.completedFuture(true);
+ return CompletableFuture.completedFuture(true);
}
- return isProxyAuthorizedFuture.thenCombine(isAuthorizedFuture, (isProxyAuthorized, isAuthorized) -> {
- if (!isProxyAuthorized) {
- log.warn("OriginalRole {} is not authorized to perform operation {} on topic {}, subscription {}",
- originalPrincipal, operation, topicName, subscriptionName);
- }
- if (!isAuthorized) {
- log.warn("Role {} is not authorized to perform operation {} on topic {}, subscription {}",
- authRole, operation, topicName, subscriptionName);
- }
- return isProxyAuthorized && isAuthorized;
- });
}
@Override
@@ -638,7 +624,7 @@ public class ServerCnx extends PulsarHandler implements TransportCnx {
if (authState.isComplete()) {
// Authentication has completed. It was either:
- // 1. the 1st time the authentication process was done, in which case we'll
+ // 1. the 1st time the authentication process was done, in which case we'll send
// a `CommandConnected` response
// 2. an authentication refresh, in which case we need to refresh authenticationData