-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#3963] feat(core): Apache Ranger Hive authorization pushdown #4515
Conversation
...r/src/main/java/org/apache/gravitino/authorization/ranger/RangerHiveAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...r/src/main/java/org/apache/gravitino/authorization/ranger/RangerHiveAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
I found that there are differences between the construction the ranger policy and our implementation. If the policyName is In our system, each policy corresponds to a single resource, and the policy is named based on the resource name. Within Ranger, we create roles in ranger, instead of putting the role in the policyName, we will put the role and role privileges into policyItems. |
f957505
to
0d7b9bc
Compare
api/src/main/java/org/apache/gravitino/authorization/RoleChange.java
Outdated
Show resolved
Hide resolved
api/src/main/java/org/apache/gravitino/authorization/RoleChange.java
Outdated
Show resolved
Hide resolved
api/src/main/java/org/apache/gravitino/authorization/RoleChange.java
Outdated
Show resolved
Hide resolved
...r/src/main/java/org/apache/gravitino/authorization/ranger/RangerHiveAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...r/src/main/java/org/apache/gravitino/authorization/ranger/RangerHiveAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...r/src/main/java/org/apache/gravitino/authorization/ranger/RangerHiveAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...r/src/main/java/org/apache/gravitino/authorization/ranger/RangerHiveAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...r/src/main/java/org/apache/gravitino/authorization/ranger/RangerHiveAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
18e9038
to
4f37b45
Compare
02a2531
to
eddc014
Compare
hi @lw-yang |
...st-common/src/test/java/org/apache/gravitino/integration/test/container/RangerContainer.java
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Show resolved
Hide resolved
api/src/main/java/org/apache/gravitino/authorization/RoleChange.java
Outdated
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
@yuqi1129 I fixed all problems based on your comments, Please help me review again. Thanks. |
...thorization-ranger/src/main/java/org/apache/gravitino/authorization/ranger/RangerHelper.java
Outdated
Show resolved
Hide resolved
...thorization-ranger/src/main/java/org/apache/gravitino/authorization/ranger/RangerHelper.java
Outdated
Show resolved
Hide resolved
return access.getType().equals(privilege); | ||
}); | ||
if (matchPrivilege | ||
&& !policyItem.getUsers().isEmpty() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need getUsers
is empty and getGroups
is empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can only remove this policy item if there are no users or groups
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We just remove roles here, not remove policyItem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right.
I fix this problem and add a test case.
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Show resolved
Hide resolved
...er/src/test/java/org/apache/gravitino/authorization/ranger/integration/test/RangerITEnv.java
Outdated
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
...thorization-ranger/src/main/java/org/apache/gravitino/authorization/ranger/RangerHelper.java
Outdated
Show resolved
Hide resolved
...thorization-ranger/src/main/java/org/apache/gravitino/authorization/ranger/RangerHelper.java
Outdated
Show resolved
Hide resolved
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Show resolved
Hide resolved
I created EPIC #4615 to track these issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
### What changes were proposed in this pull request? Use Gravitino authorization plugin to authorize Ranger Hive. 1. Added RangerHiveAuthorization modul 2. Added RangerAuthorizationPlugin abstract class. 3. Extend RangerHiveAuthorizationPlugin class process Hive authorization pushdown 4. Added Ranger client extension ### Why are the changes needed? Fix: #3963 ### Does this PR introduce _any_ user-facing change? 1. Added RangerHiveAuthorizationPlugin interface ### How was this patch tested? RangerHiveIT passed. --------- Co-authored-by: yuqi <[email protected]>
What changes were proposed in this pull request?
Use Gravitino authorization plugin to authorize Ranger Hive.
Why are the changes needed?
Fix: #3963
Does this PR introduce any user-facing change?
How was this patch tested?
RangerHiveIT passed.