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

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


The following commit(s) were added to refs/heads/branch-2.10 by this push:
     new 775d5adc0e6 [fix][broker] Pass subName for subscription operations in 
ServerCnx (#19184)
775d5adc0e6 is described below

commit 775d5adc0e6e5dac23b0810f704419e0fa428961
Author: Michael Marshall <[email protected]>
AuthorDate: Wed Jan 11 14:38:21 2023 -0600

    [fix][broker] Pass subName for subscription operations in ServerCnx (#19184)
    
    ### Motivation
    
    When a DLQ producer connects, it creates a subscription when configured to 
do so. The `subscriptionName` should be passed to the `authorizationProvider` 
to properly determine authorization.
    
    ### Modifications
    
    * Pass `initialSubscriptionName` to `isTopicOperationAllowed` method in the 
`ServerCnx`.
    
    ### Verifying this change
    
    I am going to work on generic tests to cover this case (and some others) 
when I do #19183.
    
    ### Does this pull request potentially affect one of the following parts:
    
    This is not a breaking change.
    
    ### Documentation
    
    - [x] `doc-not-needed`
    
    This only impacts users that have subscription level permissions, which are 
not well documented. We should improve those docs eventually, but there is no 
need to fix those docs while making this fix.
    
    ### Matching PR in forked repository
    
    PR in forked repository: https://github.com/michaeljmarshall/pulsar/pull/11
    
    (cherry picked from commit d96af0ac1ca7a2cc96dae1a1f150c4b1ada89143)
---
 .../src/main/java/org/apache/pulsar/broker/service/ServerCnx.java      | 3 +--
 1 file changed, 1 insertion(+), 2 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 8e81069e446..f42a52983be 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
@@ -1199,8 +1199,7 @@ public class ServerCnx extends PulsarHandler implements 
TransportCnx {
         if (!Strings.isNullOrEmpty(initialSubscriptionName)) {
             isAuthorizedFuture =
                     isAuthorizedFuture.thenCombine(
-                            isTopicOperationAllowed(topicName, 
TopicOperation.SUBSCRIBE, authenticationData,
-                                    originalAuthData),
+                            isTopicOperationAllowed(topicName, 
initialSubscriptionName, TopicOperation.SUBSCRIBE),
                             (canProduce, canSubscribe) -> canProduce && 
canSubscribe);
         }
 

Reply via email to