mirror of
https://github.com/apache/rocketmq.git
synced 2026-09-21 05:44:03 +08:00
Improve ACL 2.0 authorization context handling (#10925)
This commit is contained in:
+6
-4
@@ -16,13 +16,15 @@
|
||||
*/
|
||||
package org.apache.rocketmq.remoting.protocol.header;
|
||||
|
||||
import org.apache.rocketmq.common.action.Action;
|
||||
import org.apache.rocketmq.common.action.RocketMQAction;
|
||||
import org.apache.rocketmq.remoting.exception.RemotingCommandException;
|
||||
import org.apache.rocketmq.remoting.protocol.RequestCode;
|
||||
import org.apache.rocketmq.remoting.rpc.RpcRequestHeader;
|
||||
|
||||
@RocketMQAction(value = RequestCode.UPDATE_AND_CREATE_TOPIC_LIST, action = Action.CREATE)
|
||||
/**
|
||||
* Header metadata for a batch topic-create request. Topic names are carried in the request body.
|
||||
*
|
||||
* <p>This header must not declare {@code @RocketMQAction}: it has no concrete topic resource.
|
||||
* Authorization resources are resolved from the request body by {@code DefaultAuthorizationContextBuilder}.
|
||||
*/
|
||||
public class CreateTopicListRequestHeader extends RpcRequestHeader {
|
||||
@Override
|
||||
public void checkFields() throws RemotingCommandException {
|
||||
|
||||
+6
-5
@@ -17,15 +17,16 @@
|
||||
|
||||
package org.apache.rocketmq.remoting.protocol.header;
|
||||
|
||||
import org.apache.rocketmq.common.action.Action;
|
||||
import org.apache.rocketmq.common.action.RocketMQAction;
|
||||
import org.apache.rocketmq.common.resource.ResourceType;
|
||||
import org.apache.rocketmq.remoting.CommandCustomHeader;
|
||||
import org.apache.rocketmq.remoting.annotation.CFNotNull;
|
||||
import org.apache.rocketmq.remoting.exception.RemotingCommandException;
|
||||
import org.apache.rocketmq.remoting.protocol.RequestCode;
|
||||
|
||||
@RocketMQAction(value = RequestCode.GET_ALL_SUBSCRIPTIONGROUP_CONFIG, resource = ResourceType.GROUP, action = Action.GET)
|
||||
/**
|
||||
* This request targets the complete subscription-group configuration set and does not identify a single group.
|
||||
*
|
||||
* <p>This header must not declare {@code @RocketMQAction}: it carries no resource fields, and the
|
||||
* typed {@code Group:ANY + LIST} resource is constructed by {@code DefaultAuthorizationContextBuilder}.
|
||||
*/
|
||||
public class GetAllSubscriptionGroupRequestHeader implements CommandCustomHeader {
|
||||
@Override
|
||||
public void checkFields() throws RemotingCommandException {
|
||||
|
||||
-5
@@ -17,15 +17,10 @@
|
||||
|
||||
package org.apache.rocketmq.remoting.protocol.header;
|
||||
|
||||
import org.apache.rocketmq.common.action.Action;
|
||||
import org.apache.rocketmq.common.action.RocketMQAction;
|
||||
import org.apache.rocketmq.common.resource.ResourceType;
|
||||
import org.apache.rocketmq.remoting.CommandCustomHeader;
|
||||
import org.apache.rocketmq.remoting.annotation.CFNotNull;
|
||||
import org.apache.rocketmq.remoting.exception.RemotingCommandException;
|
||||
import org.apache.rocketmq.remoting.protocol.RequestCode;
|
||||
|
||||
@RocketMQAction(value = RequestCode.GET_ALL_SUBSCRIPTIONGROUP_CONFIG, resource = ResourceType.GROUP, action = Action.LIST)
|
||||
public class GetAllSubscriptionGroupResponseHeader implements CommandCustomHeader {
|
||||
@Override
|
||||
public void checkFields() throws RemotingCommandException {
|
||||
|
||||
+6
-5
@@ -17,15 +17,16 @@
|
||||
|
||||
package org.apache.rocketmq.remoting.protocol.header;
|
||||
|
||||
import org.apache.rocketmq.common.action.Action;
|
||||
import org.apache.rocketmq.common.action.RocketMQAction;
|
||||
import org.apache.rocketmq.common.resource.ResourceType;
|
||||
import org.apache.rocketmq.remoting.CommandCustomHeader;
|
||||
import org.apache.rocketmq.remoting.annotation.CFNotNull;
|
||||
import org.apache.rocketmq.remoting.exception.RemotingCommandException;
|
||||
import org.apache.rocketmq.remoting.protocol.RequestCode;
|
||||
|
||||
@RocketMQAction(value = RequestCode.GET_ALL_TOPIC_CONFIG, resource = ResourceType.TOPIC, action = Action.GET)
|
||||
/**
|
||||
* This request targets the complete topic configuration set and does not identify a single topic.
|
||||
*
|
||||
* <p>This header must not declare {@code @RocketMQAction}: it carries no resource fields, and the
|
||||
* typed {@code Topic:ANY + LIST} resource is constructed by {@code DefaultAuthorizationContextBuilder}.
|
||||
*/
|
||||
public class GetAllTopicConfigRequestHeader implements CommandCustomHeader {
|
||||
@Override
|
||||
public void checkFields() throws RemotingCommandException {
|
||||
|
||||
-5
@@ -20,14 +20,9 @@
|
||||
*/
|
||||
package org.apache.rocketmq.remoting.protocol.header;
|
||||
|
||||
import org.apache.rocketmq.common.action.Action;
|
||||
import org.apache.rocketmq.common.action.RocketMQAction;
|
||||
import org.apache.rocketmq.common.resource.ResourceType;
|
||||
import org.apache.rocketmq.remoting.CommandCustomHeader;
|
||||
import org.apache.rocketmq.remoting.exception.RemotingCommandException;
|
||||
import org.apache.rocketmq.remoting.protocol.RequestCode;
|
||||
|
||||
@RocketMQAction(value = RequestCode.GET_ALL_TOPIC_CONFIG, resource = ResourceType.TOPIC, action = Action.LIST)
|
||||
public class GetAllTopicConfigResponseHeader implements CommandCustomHeader {
|
||||
|
||||
@Override
|
||||
|
||||
+12
@@ -17,12 +17,24 @@
|
||||
|
||||
package org.apache.rocketmq.remoting.protocol.header;
|
||||
|
||||
import org.apache.rocketmq.common.action.Action;
|
||||
import org.apache.rocketmq.common.action.RocketMQAction;
|
||||
import org.apache.rocketmq.common.resource.ResourceType;
|
||||
import org.apache.rocketmq.common.resource.RocketMQResource;
|
||||
import org.apache.rocketmq.remoting.CommandCustomHeader;
|
||||
import org.apache.rocketmq.remoting.annotation.CFNotNull;
|
||||
import org.apache.rocketmq.remoting.exception.RemotingCommandException;
|
||||
import org.apache.rocketmq.remoting.protocol.RequestCode;
|
||||
|
||||
@RocketMQAction(value = RequestCode.GET_LITE_CLIENT_INFO, action = Action.GET)
|
||||
public class GetLiteClientInfoRequestHeader implements CommandCustomHeader {
|
||||
|
||||
@CFNotNull
|
||||
@RocketMQResource(ResourceType.TOPIC)
|
||||
private String parentTopic;
|
||||
|
||||
@CFNotNull
|
||||
@RocketMQResource(ResourceType.GROUP)
|
||||
private String group;
|
||||
private String clientId;
|
||||
private int maxCount = 1000;
|
||||
|
||||
+4
@@ -16,12 +16,16 @@
|
||||
*/
|
||||
package org.apache.rocketmq.remoting.protocol.header;
|
||||
|
||||
import org.apache.rocketmq.common.action.Action;
|
||||
import org.apache.rocketmq.common.action.RocketMQAction;
|
||||
import org.apache.rocketmq.common.resource.ResourceType;
|
||||
import org.apache.rocketmq.common.resource.RocketMQResource;
|
||||
import org.apache.rocketmq.remoting.CommandCustomHeader;
|
||||
import org.apache.rocketmq.remoting.annotation.CFNotNull;
|
||||
import org.apache.rocketmq.remoting.exception.RemotingCommandException;
|
||||
import org.apache.rocketmq.remoting.protocol.RequestCode;
|
||||
|
||||
@RocketMQAction(value = RequestCode.GET_LITE_GROUP_INFO, action = Action.GET)
|
||||
public class GetLiteGroupInfoRequestHeader implements CommandCustomHeader {
|
||||
|
||||
@CFNotNull
|
||||
|
||||
+9
@@ -17,11 +17,20 @@
|
||||
|
||||
package org.apache.rocketmq.remoting.protocol.header;
|
||||
|
||||
import org.apache.rocketmq.common.action.Action;
|
||||
import org.apache.rocketmq.common.action.RocketMQAction;
|
||||
import org.apache.rocketmq.common.resource.ResourceType;
|
||||
import org.apache.rocketmq.common.resource.RocketMQResource;
|
||||
import org.apache.rocketmq.remoting.CommandCustomHeader;
|
||||
import org.apache.rocketmq.remoting.annotation.CFNotNull;
|
||||
import org.apache.rocketmq.remoting.exception.RemotingCommandException;
|
||||
import org.apache.rocketmq.remoting.protocol.RequestCode;
|
||||
|
||||
@RocketMQAction(value = RequestCode.GET_LITE_TOPIC_INFO, action = Action.GET)
|
||||
public class GetLiteTopicInfoRequestHeader implements CommandCustomHeader {
|
||||
|
||||
@CFNotNull
|
||||
@RocketMQResource(ResourceType.TOPIC)
|
||||
private String parentTopic;
|
||||
private String liteTopic;
|
||||
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import org.apache.rocketmq.remoting.exception.RemotingCommandException;
|
||||
import org.apache.rocketmq.remoting.protocol.RequestCode;
|
||||
import org.apache.rocketmq.remoting.rpc.TopicQueueRequestHeader;
|
||||
|
||||
@RocketMQAction(value = RequestCode.GET_MAX_OFFSET, action = Action.GET)
|
||||
@RocketMQAction(value = RequestCode.GET_MAX_OFFSET, action = {Action.SUB, Action.GET})
|
||||
public class GetMaxOffsetRequestHeader extends TopicQueueRequestHeader {
|
||||
@CFNotNull
|
||||
@RocketMQResource(ResourceType.TOPIC)
|
||||
|
||||
+4
@@ -17,12 +17,16 @@
|
||||
|
||||
package org.apache.rocketmq.remoting.protocol.header;
|
||||
|
||||
import org.apache.rocketmq.common.action.Action;
|
||||
import org.apache.rocketmq.common.action.RocketMQAction;
|
||||
import org.apache.rocketmq.common.resource.ResourceType;
|
||||
import org.apache.rocketmq.common.resource.RocketMQResource;
|
||||
import org.apache.rocketmq.remoting.CommandCustomHeader;
|
||||
import org.apache.rocketmq.remoting.annotation.CFNotNull;
|
||||
import org.apache.rocketmq.remoting.exception.RemotingCommandException;
|
||||
import org.apache.rocketmq.remoting.protocol.RequestCode;
|
||||
|
||||
@RocketMQAction(value = RequestCode.GET_PARENT_TOPIC_INFO, action = Action.GET)
|
||||
public class GetParentTopicInfoRequestHeader implements CommandCustomHeader {
|
||||
|
||||
@CFNotNull
|
||||
|
||||
+4
@@ -18,12 +18,16 @@
|
||||
package org.apache.rocketmq.remoting.protocol.header;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import org.apache.rocketmq.common.action.Action;
|
||||
import org.apache.rocketmq.common.action.RocketMQAction;
|
||||
import org.apache.rocketmq.common.resource.ResourceType;
|
||||
import org.apache.rocketmq.common.resource.RocketMQResource;
|
||||
import org.apache.rocketmq.remoting.annotation.CFNotNull;
|
||||
import org.apache.rocketmq.remoting.exception.RemotingCommandException;
|
||||
import org.apache.rocketmq.remoting.protocol.RequestCode;
|
||||
import org.apache.rocketmq.remoting.rpc.RpcRequestHeader;
|
||||
|
||||
@RocketMQAction(value = RequestCode.POP_LITE_MESSAGE, action = Action.SUB)
|
||||
public class PopLiteMessageRequestHeader extends RpcRequestHeader {
|
||||
|
||||
@CFNotNull
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import org.apache.rocketmq.remoting.exception.RemotingCommandException;
|
||||
import org.apache.rocketmq.remoting.protocol.RequestCode;
|
||||
import org.apache.rocketmq.remoting.rpc.TopicQueueRequestHeader;
|
||||
|
||||
@RocketMQAction(value = RequestCode.SEARCH_OFFSET_BY_TIMESTAMP, action = Action.GET)
|
||||
@RocketMQAction(value = RequestCode.SEARCH_OFFSET_BY_TIMESTAMP, action = {Action.SUB, Action.GET})
|
||||
public class SearchOffsetRequestHeader extends TopicQueueRequestHeader {
|
||||
@CFNotNull
|
||||
@RocketMQResource(ResourceType.TOPIC)
|
||||
|
||||
+4
@@ -16,12 +16,16 @@
|
||||
*/
|
||||
package org.apache.rocketmq.remoting.protocol.header;
|
||||
|
||||
import org.apache.rocketmq.common.action.Action;
|
||||
import org.apache.rocketmq.common.action.RocketMQAction;
|
||||
import org.apache.rocketmq.common.resource.ResourceType;
|
||||
import org.apache.rocketmq.common.resource.RocketMQResource;
|
||||
import org.apache.rocketmq.remoting.CommandCustomHeader;
|
||||
import org.apache.rocketmq.remoting.annotation.CFNotNull;
|
||||
import org.apache.rocketmq.remoting.exception.RemotingCommandException;
|
||||
import org.apache.rocketmq.remoting.protocol.RequestCode;
|
||||
|
||||
@RocketMQAction(value = RequestCode.TRIGGER_LITE_DISPATCH, action = Action.UPDATE)
|
||||
public class TriggerLiteDispatchRequestHeader implements CommandCustomHeader {
|
||||
|
||||
@CFNotNull
|
||||
|
||||
Reference in New Issue
Block a user