You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by rx...@apache.org on 2020/07/30 03:26:46 UTC

[pulsar] 02/02: passes on authenticationData (#7694)

This is an automated email from the ASF dual-hosted git repository.

rxl pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit 7e59203cacdbc60d46914e4f432a3aa734aab27f
Author: Joshua Decosta <jo...@gmail.com>
AuthorDate: Wed Jul 29 23:23:36 2020 -0400

    passes on authenticationData (#7694)
    
    # Fixes #7693
    
    Motivation
    When trying to chase down a bug in my custom AuthenticationProvider I found that when attempting to consume a topic that I wasn't authorized on would fail to produce an unauthorized response while using the pulsar-client. I noticed that the canConsumeAsync within AuthorizationService canLookUpAsync doesn't pass along the AuthenticationDataSource when it should. My code relied on that to be passed down each time and thus my methods would never return.
    
    # Modifications
    I've added the AuthenticationDataSource to the canConsumeAsync method.
    
    (cherry picked from commit c7dc7824ddd58ec29be0a2702cae226d3125dd53)
---
 .../org/apache/pulsar/broker/authorization/AuthorizationService.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/AuthorizationService.java b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/AuthorizationService.java
index 10b35ef..4dc99bf 100644
--- a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/AuthorizationService.java
+++ b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/AuthorizationService.java
@@ -304,7 +304,7 @@ public class AuthorizationService {
                             topicName.toString(), role, ex.getMessage());
                 }
             }
-            canConsumeAsync(topicName, role, null, null).whenComplete((consumeAuthorized, e) -> {
+            canConsumeAsync(topicName, role, authenticationData, null).whenComplete((consumeAuthorized, e) -> {
                 if (e == null) {
                     if (consumeAuthorized) {
                         finalResult.complete(consumeAuthorized);