-
Notifications
You must be signed in to change notification settings - Fork 1.3k
RBAC: Support github teams #2751 #4012
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
RBAC: Support github teams #2751 #4012
Conversation
Haarolean
left a comment
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.
Hi, and thanks for your contribution. Please take a look at the comment I've left.
Also, please refer to our contributing guide and follow one for the future contributions (I've been working on this issue already thus the issue was assigned to me), having you to comment on the issue to grab it beforehand would be nice.
...pi/src/main/java/com/provectus/kafka/ui/service/rbac/extractor/GithubAuthorityExtractor.java
Outdated
Show resolved
Hide resolved
| String[] organizationAndTeam = orgTeam.split("/"); | ||
| String org = organizationAndTeam[0]; | ||
| String team = organizationAndTeam[1]; | ||
| WebClient wc = WebClient.create( |
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.
I believe we can refrain from creating a webclient for every each of the requests
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.
I have added git gitHubApiUri property to OAuthProperties.OAuth2Provider that is later used as base GitHub api URI
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 don't need such a property as it should be fetched via OpenID provider configuration request.
You can fetch it via req.getClientRegistration().getProviderDetails().getUserInfoEndpoint().getUri()
...pi/src/main/java/com/provectus/kafka/ui/service/rbac/extractor/GithubAuthorityExtractor.java
Outdated
Show resolved
Hide resolved
...pi/src/main/java/com/provectus/kafka/ui/service/rbac/extractor/GithubAuthorityExtractor.java
Outdated
Show resolved
Hide resolved
| return teams | ||
| .doOnNext(t -> { | ||
| if (t.getRight() instanceof Map) { | ||
| Map<String, String> response = (Map<String, String>) t.getRight(); |
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'd like to see a cleaner approach here, let's say this:
- we filter the roles we have and if there are no subjects matching github teams, we can skip teams fetching altogether
- the same applies to organizations, if none are present in roles, we don't have to query organizations either
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.
I am not sure, if I understand, can you explain a little bit more please? Thanks!
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.
- don't fetch user teams if there are no RBAC subjects with "oauth_github/team" present, the same applies to organizations
- don't use pairs, concat three lists, each one for roles by orgs, roles by teams and roles by username.
Cleanup of the code Reuse of WebClient to get GitHub teams info
|
@maros2710 are you still interested in completing this or can I try resolving the review comments? |
|
Closing in favor of #4093 |
What changes did you make? (Give an overview)
Closes #2751
Added github teams support. (see #2751)
Now you can set up github team in rbac configuration like this:
Is there anything you'd like reviewers to focus on?
I am not very good at reactor, so maybe look at my reactive pipelines, please :)
How Has This Been Tested? (put an "x" (case-sensitive!) next to an item)
Checklist (put an "x" (case-sensitive!) next to all the items, otherwise the build will fail)
Check out Contributing and Code of Conduct