Skip to content

[#7570] feat(authz): Support topic authorization#7580

Merged
xunliu merged 11 commits intoapache:branch-metadata-authzfrom
KyleLin0927:issue-7570
Jul 14, 2025
Merged

[#7570] feat(authz): Support topic authorization#7580
xunliu merged 11 commits intoapache:branch-metadata-authzfrom
KyleLin0927:issue-7570

Conversation

@KyleLin0927
Copy link
Contributor

What changes were proposed in this pull request?

Support topic authorization.

Why are the changes needed?

Fixes #7570

Does this PR introduce any user-facing change?

No.

How was this patch tested?

org.apache.gravitino.client.integration.test.authorization.TopicAuthorizationIT

@PathParam("catalog") @AuthorizationMetadata(type = MetadataObject.Type.CATALOG)
String catalog,
@PathParam("schema") @AuthorizationMetadata(type = MetadataObject.Type.SCHEMA)
String schema) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list interface does not require AuthorizationMetadata.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

topics =
MetadataFilterHelper.filterByExpression(
metalake,
"METALAKE::CONSUME_TOPIC || CATALOG::CONSUME_TOPIC || SCHEMA::CONSUME_TOPIC || TOPIC::CONSUME_TOPIC || METALAKE::PRODUCE_TOPIC ||CATALOG::PRODUCE_TOPIC || SCHEMA::PRODUCE_TOPIC || TOPIC::PRODUCE_TOPIC || METALAKE::OWNERSHIP || CATALOG::OWNERSHIP || SCHEMA::OWNERSHIP || TOPIC::OWNERSHIP",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

USE_CATALOG and USE_SCHEMA is required.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@ResponseMetered(name = "load-topic", absolute = true)
@AuthorizationExpression(
expression =
"METALAKE::CONSUME_TOPIC || CATALOG::CONSUME_TOPIC || SCHEMA::CONSUME_TOPIC || TOPIC::CONSUME_TOPIC || METALAKE::PRODUCE_TOPIC || CATALOG::PRODUCE_TOPIC || SCHEMA::PRODUCE_TOPIC || TOPIC::PRODUCE_TOPIC || METALAKE::OWNERSHIP || CATALOG::OWNERSHIP || SCHEMA::OWNERSHIP || TOPIC::OWNERSHIP",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

USE_CATALOG and USE_SCHEMA is required.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use any expression like ANY(SELECT_TABLE,METALAKE,CATALOG,SCHEMA,TABLE)

Please refer to https://github.com/apache/gravitino/pull/7577/files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

topics =
MetadataFilterHelper.filterByExpression(
metalake,
"METALAKE::CONSUME_TOPIC || CATALOG::CONSUME_TOPIC || SCHEMA::CONSUME_TOPIC || TOPIC::CONSUME_TOPIC || METALAKE::PRODUCE_TOPIC ||CATALOG::PRODUCE_TOPIC || SCHEMA::PRODUCE_TOPIC || TOPIC::PRODUCE_TOPIC || METALAKE::OWNERSHIP || CATALOG::OWNERSHIP || SCHEMA::OWNERSHIP || TOPIC::OWNERSHIP",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use any expression like ANY(SELECT_TABLE,METALAKE,CATALOG,SCHEMA,TABLE)

Please refer to https://github.com/apache/gravitino/pull/7577/files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@ResponseMetered(name = "create-topic", absolute = true)
@AuthorizationExpression(
expression =
"METALAKE::CREATE_TOPIC || CATALOG::CREATE_TOPIC || SCHEMA::CREATE_TOPIC || METALAKE::OWNER || CATALOG::OWNER || SCHEMA::OWNER",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use any expression like ANY(SELECT_TABLE,METALAKE,CATALOG,SCHEMA,TABLE)

Please refer to https://github.com/apache/gravitino/pull/7577/files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@ResponseMetered(name = "load-topic", absolute = true)
@AuthorizationExpression(
expression =
"METALAKE::CONSUME_TOPIC || CATALOG::CONSUME_TOPIC || SCHEMA::CONSUME_TOPIC || TOPIC::CONSUME_TOPIC || METALAKE::PRODUCE_TOPIC || CATALOG::PRODUCE_TOPIC || SCHEMA::PRODUCE_TOPIC || TOPIC::PRODUCE_TOPIC || METALAKE::OWNERSHIP || CATALOG::OWNERSHIP || SCHEMA::OWNERSHIP || TOPIC::OWNERSHIP",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use any expression like ANY(SELECT_TABLE,METALAKE,CATALOG,SCHEMA,TABLE)

Please refer to https://github.com/apache/gravitino/pull/7577/files

@ResponseMetered(name = "alter-topic", absolute = true)
@AuthorizationExpression(
expression =
"METALAKE::PRODUCE_TOPIC || CATALOG::PRODUCE_TOPIC || SCHEMA::PRODUCE_TOPIC || TOPIC::PRODUCE_TOPIC || METALAKE::OWNERSHIP || CATALOG::OWNERSHIP || SCHEMA::OWNERSHIP || TOPIC::OWNERSHIP",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use any expression like ANY(SELECT_TABLE,METALAKE,CATALOG,SCHEMA,TABLE)

Please refer to https://github.com/apache/gravitino/pull/7577/files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@ResponseMetered(name = "drop-topic", absolute = true)
@AuthorizationExpression(
expression =
"METALAKE::OWNERSHIP || CATALOG::OWNERSHIP || SCHEMA::OWNERSHIP || TOPIC::OWNERSHIP",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use any expression like ANY(SELECT_TABLE,METALAKE,CATALOG,SCHEMA,TABLE)

Please refer to https://github.com/apache/gravitino/pull/7577/files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@hdygxsj hdygxsj self-assigned this Jul 10, 2025
@hdygxsj
Copy link
Contributor

hdygxsj commented Jul 11, 2025

PHAL @jerqi

Copy link
Contributor

@roryqi roryqi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, wait for CI.

Copy link
Member

@xunliu xunliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xunliu xunliu merged commit 4ae2440 into apache:branch-metadata-authz Jul 14, 2025
30 checks passed
hdygxsj added a commit to hdygxsj/gravitino that referenced this pull request Jul 15, 2025
### What changes were proposed in this pull request?

Support topic authorization.

### Why are the changes needed?

Fixes apache#7570

### Does this PR introduce any user-facing change?

No.

### How was this patch tested?


`org.apache.gravitino.client.integration.test.authorization.TopicAuthorizationIT`

---------

Co-authored-by: yangyang zhong <35210666+hdygxsj@users.noreply.github.com>
Co-authored-by: 1161623489@qq.com <1161623489@qq.com>
hdygxsj added a commit to hdygxsj/gravitino that referenced this pull request Jul 15, 2025
### What changes were proposed in this pull request?

Support topic authorization.

### Why are the changes needed?

Fixes apache#7570

### Does this PR introduce any user-facing change?

No.

### How was this patch tested?


`org.apache.gravitino.client.integration.test.authorization.TopicAuthorizationIT`

---------

Co-authored-by: yangyang zhong <35210666+hdygxsj@users.noreply.github.com>
Co-authored-by: 1161623489@qq.com <1161623489@qq.com>
hdygxsj added a commit to hdygxsj/gravitino that referenced this pull request Jul 15, 2025
### What changes were proposed in this pull request?

Support topic authorization.

### Why are the changes needed?

Fixes apache#7570

### Does this PR introduce any user-facing change?

No.

### How was this patch tested?


`org.apache.gravitino.client.integration.test.authorization.TopicAuthorizationIT`

---------

Co-authored-by: yangyang zhong <35210666+hdygxsj@users.noreply.github.com>
Co-authored-by: 1161623489@qq.com <1161623489@qq.com>
jerryshao pushed a commit that referenced this pull request Jul 15, 2025
### What changes were proposed in this pull request?

Support topic authorization.

### Why are the changes needed?

Fixes #7570

### Does this PR introduce any user-facing change?

No.

### How was this patch tested?


`org.apache.gravitino.client.integration.test.authorization.TopicAuthorizationIT`

---------

Co-authored-by: yangyang zhong <35210666+hdygxsj@users.noreply.github.com>
Co-authored-by: 1161623489@qq.com <1161623489@qq.com>
roryqi pushed a commit to qqqttt123/gravitino that referenced this pull request Jul 30, 2025
### What changes were proposed in this pull request?

Support topic authorization.

### Why are the changes needed?

Fixes apache#7570

### Does this PR introduce any user-facing change?

No.

### How was this patch tested?


`org.apache.gravitino.client.integration.test.authorization.TopicAuthorizationIT`

---------

Co-authored-by: yangyang zhong <35210666+hdygxsj@users.noreply.github.com>
Co-authored-by: 1161623489@qq.com <1161623489@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants