Repository navigation
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: AnujaVane The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @AnujaVane. Thanks for your PR. I'm waiting for a feast-dev member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
run |
| } | ||
| ApiClient defaultClient = Configuration.getDefaultApiClient(); | ||
| defaultClient.setBasePath(options.get("basePath")); | ||
| defaultClient.setBasePath((String) options.get("basePath")); |
There was a problem hiding this comment.
a better name for the option is authorizationUrl
| public AuthorizationResult checkAccess(String project, Authentication authentication) { | ||
| String email = getEmailFromAuth(authentication); | ||
| String subject = (String) this.options.get("subject"); | ||
| if ((subject == null) || (subject.isEmpty())) subject = "email"; |
There was a problem hiding this comment.
email should be a constant like DEFAULT_SUBJECT_CLAIM
| */ | ||
| public AuthorizationResult checkAccess(String project, Authentication authentication) { | ||
| String email = getEmailFromAuth(authentication); | ||
| String subject = (String) this.options.get("subject"); |
There was a problem hiding this comment.
A better name for this option is subjectClaim
There was a problem hiding this comment.
rename the option and the variable actually
| * @return String user email | ||
| */ | ||
| private String getEmailFromAuth(Authentication authentication) { | ||
| private String getSubjectFromAuth(Authentication authentication, String subject) { |
There was a problem hiding this comment.
rename subject to subjectClaim
| Jwt principle = ((Jwt) authentication.getPrincipal()); | ||
| Map<String, Object> claims = principle.getClaims(); | ||
| String email = (String) claims.get("email"); | ||
| String subjectValue = (String) claims.get(subject); |
There was a problem hiding this comment.
subjectValue can then be named subject
| @@ -54,6 +54,6 @@ public static class AuthorizationProperties { | |||
| private String provider; | |||
|
|
|||
| // K/V options to initialize the provider with | |||
There was a problem hiding this comment.
this is no longer a k/V pair since we allow a list for roles. may be worth a conversation
| || (String.format("roles:feast:%s-member", project)).equals(role.getId())) { | ||
| return AuthorizationResult.success(); | ||
| for (String roleTemplate : roleTemplates) { | ||
| if (roleTemplate.contains("{PROJECT}")) { |
There was a problem hiding this comment.
PROJECT could be a constant and actually could be in a list of constants that could be replaced in the role templates.
|
/lgtm |
|
/ok-to-test |
| subject: email | ||
| roles: | ||
| - role:feast:admin | ||
| - role:feast:{PROJECT}-member |
There was a problem hiding this comment.
I am a bit wary about using complex objects as options. I would strongly prefer to stick to K/V here, so perhaps we can turn roles into a CSV.
|
I think a fundamental problem that I have with the current |
|
/ok-to-test |
|
@AnujaVane: The following tests failed, say
DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
|
replaced with #864 |
What this PR does / why we need it:
Does this PR introduce a user-facing change?: NONE