Skip to content

[ZEPPELIN-2913] Support for both user and role for AuthorizationFilter#3004

Closed
prabhjyotsingh wants to merge 3 commits intoapache:masterfrom
prabhjyotsingh:ZEPPELIN-2913
Closed

[ZEPPELIN-2913] Support for both user and role for AuthorizationFilter#3004
prabhjyotsingh wants to merge 3 commits intoapache:masterfrom
prabhjyotsingh:ZEPPELIN-2913

Conversation

@prabhjyotsingh
Copy link
Copy Markdown
Contributor

@prabhjyotsingh prabhjyotsingh commented Jun 5, 2018

What is this PR for?

Currently, Zeppelin only supports roles for AuthorizationFilter, but there can be a condition as described in https://issues.apache.org/jira/browse/ZEPPELIN-2913 where Zeppelin's user does not belong to a group/role, and the administrator wants to have control using user only.

What type of PR is it?

[Feature]

Todos

  • - Add documentation

What is the Jira issue?

How should this be tested?

add the following in shiro.ini:

[main]
...
anyofroles = org.apache.zeppelin.utils.AnyOfRolesUserAuthorizationFilter

[urls]
...
/api/interpreter/** = authc, anyofroles[admin, user1]
/api/configurations/** = authc, roles[admin]
/api/credential/** = authc, roles[admin]

With the above config both user (user1) and users the belong to role admin will have access to interpreter setting page.

Change-Id: I5a83e5701d22ac40b37cc8c3d4c9414ef007b99c
@prabhjyotsingh
Copy link
Copy Markdown
Contributor Author

@zjffdu @VipinRathor can you help review this PR

Change-Id: I89ae41634871fadcbb86d8d77ee60605776e97d4
* Basically, it's the same as {@link RolesAuthorizationFilter} but using {@literal OR} instead
* of {@literal AND} on the specified roles or user.
*/
public class AnyOfRolesUserAuthorizationFilter extends RolesAuthorizationFilter {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@prabhjyotsingh how about updating AnyOfRolesAuthorizationFilter class instead of adding a new AnyOfRolesUserAuthorizationFilter?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, I've made the suggested changes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks!

…lter

Change-Id: Idb3cf44a177522a6003e552660777dd57bcfabfd
@VipinRathor
Copy link
Copy Markdown
Contributor

LGTM

@asfgit asfgit closed this in d45d878 Jun 7, 2018
asfgit pushed a commit that referenced this pull request Jun 7, 2018
Currently, Zeppelin only supports roles for AuthorizationFilter, but there can be a condition as described in https://issues.apache.org/jira/browse/ZEPPELIN-2913 where Zeppelin's user does not belong to a group/role, and the administrator wants to have control using user only.

[Feature]

* [x] - Add documentation

* https://issues.apache.org/jira/browse/ZEPPELIN-2913

add the following in shiro.ini:
```
[main]
...
anyofroles = org.apache.zeppelin.utils.AnyOfRolesUserAuthorizationFilter

[urls]
...
/api/interpreter/** = authc, anyofroles[admin, user1]
/api/configurations/** = authc, roles[admin]
/api/credential/** = authc, roles[admin]
```
With the above config both user (user1) and users the belong to role admin will have access to interpreter setting page.

Author: Prabhjyot Singh <[email protected]>

Closes #3004 from prabhjyotsingh/ZEPPELIN-2913 and squashes the following commits:

e05d72a [Prabhjyot Singh] rename AnyOfRolesAuthorizationFilter to AnyOfRolesUserAuthorizationFilter
724192f [Prabhjyot Singh] add doc
53c0c03 [Prabhjyot Singh] [ZEPPELIN-2913] support for both user and role

Change-Id: I63cdebf66d76a67cfca0054283c7d1c65a9b5805
(cherry picked from commit d45d878)
Signed-off-by: Prabhjyot Singh <[email protected]>

# Conflicts:
#	zeppelin-server/src/main/java/org/apache/zeppelin/utils/AnyOfRolesUserAuthorizationFilter.java
prabhjyotsingh added a commit to prabhjyotsingh/zeppelin that referenced this pull request Jul 4, 2018
Currently, Zeppelin only supports roles for AuthorizationFilter, but there can be a condition as described in https://issues.apache.org/jira/browse/ZEPPELIN-2913 where Zeppelin's user does not belong to a group/role, and the administrator wants to have control using user only.

[Feature]

* [x] - Add documentation

* https://issues.apache.org/jira/browse/ZEPPELIN-2913

add the following in shiro.ini:
```
[main]
...
anyofroles = org.apache.zeppelin.utils.AnyOfRolesUserAuthorizationFilter

[urls]
...
/api/interpreter/** = authc, anyofroles[admin, user1]
/api/configurations/** = authc, roles[admin]
/api/credential/** = authc, roles[admin]
```
With the above config both user (user1) and users the belong to role admin will have access to interpreter setting page.

Author: Prabhjyot Singh <[email protected]>

Closes apache#3004 from prabhjyotsingh/ZEPPELIN-2913 and squashes the following commits:

e05d72a [Prabhjyot Singh] rename AnyOfRolesAuthorizationFilter to AnyOfRolesUserAuthorizationFilter
724192f [Prabhjyot Singh] add doc
53c0c03 [Prabhjyot Singh] [ZEPPELIN-2913] support for both user and role

Change-Id: I63cdebf66d76a67cfca0054283c7d1c65a9b5805
(cherry picked from commit d45d878)
Signed-off-by: Prabhjyot Singh <[email protected]>
mckartha pushed a commit to syntechdev/zeppelin that referenced this pull request Aug 9, 2018
Currently, Zeppelin only supports roles for AuthorizationFilter, but there can be a condition as described in https://issues.apache.org/jira/browse/ZEPPELIN-2913 where Zeppelin's user does not belong to a group/role, and the administrator wants to have control using user only.

[Feature]

* [x] - Add documentation

* https://issues.apache.org/jira/browse/ZEPPELIN-2913

add the following in shiro.ini:
```
[main]
...
anyofroles = org.apache.zeppelin.utils.AnyOfRolesUserAuthorizationFilter

[urls]
...
/api/interpreter/** = authc, anyofroles[admin, user1]
/api/configurations/** = authc, roles[admin]
/api/credential/** = authc, roles[admin]
```
With the above config both user (user1) and users the belong to role admin will have access to interpreter setting page.

Author: Prabhjyot Singh <[email protected]>

Closes apache#3004 from prabhjyotsingh/ZEPPELIN-2913 and squashes the following commits:

e05d72a [Prabhjyot Singh] rename AnyOfRolesAuthorizationFilter to AnyOfRolesUserAuthorizationFilter
724192f [Prabhjyot Singh] add doc
53c0c03 [Prabhjyot Singh] [ZEPPELIN-2913] support for both user and role

Change-Id: I63cdebf66d76a67cfca0054283c7d1c65a9b5805
mckartha pushed a commit to syntechdev/zeppelin that referenced this pull request Aug 9, 2018
Currently, Zeppelin only supports roles for AuthorizationFilter, but there can be a condition as described in https://issues.apache.org/jira/browse/ZEPPELIN-2913 where Zeppelin's user does not belong to a group/role, and the administrator wants to have control using user only.

[Feature]

* [x] - Add documentation

* https://issues.apache.org/jira/browse/ZEPPELIN-2913

add the following in shiro.ini:
```
[main]
...
anyofroles = org.apache.zeppelin.utils.AnyOfRolesUserAuthorizationFilter

[urls]
...
/api/interpreter/** = authc, anyofroles[admin, user1]
/api/configurations/** = authc, roles[admin]
/api/credential/** = authc, roles[admin]
```
With the above config both user (user1) and users the belong to role admin will have access to interpreter setting page.

Author: Prabhjyot Singh <[email protected]>

Closes apache#3004 from prabhjyotsingh/ZEPPELIN-2913 and squashes the following commits:

e05d72a [Prabhjyot Singh] rename AnyOfRolesAuthorizationFilter to AnyOfRolesUserAuthorizationFilter
724192f [Prabhjyot Singh] add doc
53c0c03 [Prabhjyot Singh] [ZEPPELIN-2913] support for both user and role

Change-Id: I63cdebf66d76a67cfca0054283c7d1c65a9b5805
(cherry picked from commit d45d878)
Signed-off-by: Prabhjyot Singh <[email protected]>

# Conflicts:
#	zeppelin-server/src/main/java/org/apache/zeppelin/utils/AnyOfRolesUserAuthorizationFilter.java
@prabhjyotsingh prabhjyotsingh deleted the ZEPPELIN-2913 branch May 2, 2022 16:26
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.

2 participants