KAFKA-18813: [3/N] Client support for TopicAuthException in DescribeConsumerGroup path (#18996)

Reviewers: David Jacot <djacot@confluent.io>
This commit is contained in:
Lianet Magrans 2025-02-21 12:42:00 -05:00 committed by Lianet Magrans
parent 8383c88a70
commit 364479cf24
2 changed files with 4 additions and 0 deletions

View File

@ -331,7 +331,9 @@ public class DescribeConsumerGroupsHandler implements AdminApiHandler<Coordinato
switch (error) {
case GROUP_AUTHORIZATION_FAILED:
case TOPIC_AUTHORIZATION_FAILED:
log.debug("`{}` request for group id {} failed due to error {}.", apiName, groupId.idValue, error);
// The topic auth response received on DescribeConsumerGroup is a generic one not including topic names, so we just pass it on unchanged here.
failed.put(groupId, error.exception(errorMsg));
break;

View File

@ -30,6 +30,7 @@ import org.apache.kafka.common.Uuid;
import org.apache.kafka.common.errors.GroupAuthorizationException;
import org.apache.kafka.common.errors.GroupIdNotFoundException;
import org.apache.kafka.common.errors.InvalidGroupIdException;
import org.apache.kafka.common.errors.TopicAuthorizationException;
import org.apache.kafka.common.errors.UnsupportedVersionException;
import org.apache.kafka.common.message.ConsumerGroupDescribeRequestData;
import org.apache.kafka.common.message.ConsumerGroupDescribeResponseData;
@ -321,6 +322,7 @@ public class DescribeConsumerGroupsHandlerTest {
@Test
public void testFailedHandleConsumerGroupResponse() {
assertFailed(GroupAuthorizationException.class, handleConsumerGroupWithError(Errors.GROUP_AUTHORIZATION_FAILED));
assertFailed(TopicAuthorizationException.class, handleConsumerGroupWithError(Errors.TOPIC_AUTHORIZATION_FAILED));
assertFailed(InvalidGroupIdException.class, handleConsumerGroupWithError(Errors.INVALID_GROUP_ID));
}