This is an automated email from the ASF dual-hosted git repository.
mmarshall 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 d96af0ac1ca [fix][broker] Pass subName for subscription operations in
ServerCnx (#19184)
d96af0ac1ca is described below
commit d96af0ac1ca7a2cc96dae1a1f150c4b1ada89143
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
---
.../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 c0357c14a20..8a806a14fb1 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
@@ -1287,8 +1287,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);
}