Skip to content
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

[Broker] Support array type claims in JWT #10375

Merged
merged 1 commit into from
Apr 26, 2021

Conversation

RobertIndie
Copy link
Member

Motivation

In some use cases of JWT, the type of role claim in the token is the array type.
For example, the token in Azure ActiveDirectory is like the following:

{
......
  "roles": [
    "user1"
  ],
......
}

Currently, pulsar's JWT cannot support handling array-type claims, we need to add support for this.

Modifications

  • Add support handling array-type claims for pulsar JWT authentication. If the role claim is the array type, take the first element as the role.

@RobertIndie
Copy link
Member Author

/pulsarbot run-failure-checks

@merlimat merlimat added the type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages label Apr 26, 2021
@merlimat merlimat added this to the 2.8.0 milestone Apr 26, 2021
@merlimat merlimat merged commit b31b71e into apache:master Apr 26, 2021
codelipenghui pushed a commit that referenced this pull request Jul 23, 2021
### Motivation

In #10375, we add multi roles support for JWT authentication. But the authorization does not support multi roles currently. Only the first one in the roles array will be used during authorization. This PR adds multi roles support for authorization.

### Modifications

* Add MultiRolesTokenAuthorizationProvider. It will check the permissions of all the roles in the roles array, and when one of the roles has permissions, it means that the current operation has permissions.
codelipenghui pushed a commit that referenced this pull request Jul 23, 2021
### Motivation

In #10375, we add multi roles support for JWT authentication. But the authorization does not support multi roles currently. Only the first one in the roles array will be used during authorization. This PR adds multi roles support for authorization.

### Modifications

* Add MultiRolesTokenAuthorizationProvider. It will check the permissions of all the roles in the roles array, and when one of the roles has permissions, it means that the current operation has permissions.

(cherry picked from commit 62b5dfb)
bharanic-dev pushed a commit to bharanic-dev/pulsar that referenced this pull request Mar 18, 2022
### Motivation

In apache#10375, we add multi roles support for JWT authentication. But the authorization does not support multi roles currently. Only the first one in the roles array will be used during authorization. This PR adds multi roles support for authorization.

### Modifications

* Add MultiRolesTokenAuthorizationProvider. It will check the permissions of all the roles in the roles array, and when one of the roles has permissions, it means that the current operation has permissions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants