Skip to content

Commit

Permalink
[fix][broker] Pass subName for subscription operations in ServerCnx (a…
Browse files Browse the repository at this point in the history
…pache#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 apache#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: michaeljmarshall#11

(cherry picked from commit d96af0a)
  • Loading branch information
michaeljmarshall committed Jan 11, 2023
1 parent 41bb1b0 commit 348085b
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1252,8 +1252,7 @@ protected void handleProducer(final CommandProducer cmdProducer) {
if (!Strings.isNullOrEmpty(initialSubscriptionName)) {
isAuthorizedFuture =
isAuthorizedFuture.thenCombine(
isTopicOperationAllowed(topicName, TopicOperation.SUBSCRIBE, authenticationData,
originalAuthData),
isTopicOperationAllowed(topicName, initialSubscriptionName, TopicOperation.SUBSCRIBE),
(canProduce, canSubscribe) -> canProduce && canSubscribe);
}

Expand Down

0 comments on commit 348085b

Please sign in to comment.