-
Notifications
You must be signed in to change notification settings - Fork 577
CNTRLPLANE-311: adding auth config missing fields to API #2487
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
base: master
Are you sure you want to change the base?
Conversation
|
Hello @ShazaAldawamneh! Some important instructions when contributing to openshift/api: |
|
@ShazaAldawamneh: This pull request references CNTRLPLANE-311 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.21.0" version, but no target version was set. In response to this: Instructions 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 openshift-eng/jira-lifecycle-plugin repository. |
config/v1/tests/authentications.config.openshift.io/ExternalOIDCWithNewAuthConfigFields.yaml
Outdated
Show resolved
Hide resolved
config/v1/tests/authentications.config.openshift.io/ExternalOIDCWithUpstreamParity.yaml
Show resolved
Hide resolved
config/v1/tests/authentications.config.openshift.io/ExternalOIDCWithNewAuthConfigFields.yaml
Outdated
Show resolved
Hide resolved
config/v1/tests/authentications.config.openshift.io/ExternalOIDCWithNewAuthConfigFields.yaml
Outdated
Show resolved
Hide resolved
|
/assign |
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.
For all of the CEL expression fields, can we also get a PR up against openshift/kubernetes similar to openshift/kubernetes#2353 to show that we are going to be adding admission time validation for the newly added CEL expression fields?
config/v1/tests/authentications.config.openshift.io/ExternalOIDCWithUpstreamParity.yaml
Outdated
Show resolved
Hide resolved
Signed-off-by: Shaza Aldawamneh <[email protected]>
582db23 to
f854a3d
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@ShazaAldawamneh: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions 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-sigs/prow repository. I understand the commands that are listed here. |
| // See https://kubernetes.io/docs/reference/using-api/cel/ for CEL syntax. | ||
| // +listType=atomic | ||
| // +kubebuilder:validation:MaxItems=64 | ||
| // +kubebuilder:validation:XValidation:rule="self.size() == 0 || <feature-gate-enabled-check>",message="user validation rules are not supported when StructuredAuthenticationConfiguration feature gate is disabled" |
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.
| // +kubebuilder:validation:XValidation:rule="self.size() == 0 || <feature-gate-enabled-check>",message="user validation rules are not supported when StructuredAuthenticationConfiguration feature gate is disabled" |
| // +listType=atomic | ||
| // +kubebuilder:validation:MaxItems=64 | ||
| // +kubebuilder:validation:XValidation:rule="self.size() == 0 || <feature-gate-enabled-check>",message="user validation rules are not supported when StructuredAuthenticationConfiguration feature gate is disabled" | ||
| // +kubebuilder:validation:XValidation:rule="self.all(x, x.expression.size() > 0)",message="each expression must be non-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.
Expression is already required with a minimum length of 1, meaning it cannot be empty. That should be sufficient enforcement here, no need for this CEL check as well.
| // +kubebuilder:validation:MaxItems=64 | ||
| // +kubebuilder:validation:XValidation:rule="self.size() == 0 || <feature-gate-enabled-check>",message="user validation rules are not supported when StructuredAuthenticationConfiguration feature gate is disabled" | ||
| // +kubebuilder:validation:XValidation:rule="self.all(x, x.expression.size() > 0)",message="each expression must be non-empty" | ||
| // +kubebuilder:validation:XValidation:rule="self.map(x, x.expression).countDistinct() == self.size()",message="expressions must be unique" |
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 don't think countDistinct() is a real thing? Instead of an atomic list, we should probably make this a listType=map and set the listMapKey=expression so that it keys uniqueness of the list on that value.
| // +kubebuilder:validation:XValidation:rule="self.size() > 0 ? isURL(self) : true",message="discoveryURL must be a valid URL" | ||
| // +kubebuilder:validation:XValidation:rule="self.size() > 0 ? (isURL(self) && url(self).getScheme() == 'https') : true",message="discoveryURL must be a valid https URL" | ||
| // +kubebuilder:validation:XValidation:rule="self.size() > 0 ? url(self).getQuery().size() == 0 : true",message="discoveryURL must not contain query parameters" |
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 don't think we actually need the self.size() > 0 on all of these?
| // +enum | ||
| // TokenValidationRuleType defines the type of token validation rule. | ||
| // | ||
| // +kubebuilder:validation:Type=string |
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.
Keep the +enum marker, remove this one please.
| // | ||
| // +optional | ||
| // +openshift:enable:FeatureGate=ExternalOIDCWithUpstreamParity | ||
| ExpressionRule *TokenExpressionRule `json:"expressionRule,omitempty"` |
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.
When using a discriminated union, the discriminant (in this case the type field) and the required to be set must match in naming. Because the type option that corresponds to this field is Expression, this field should be named expression:
| ExpressionRule *TokenExpressionRule `json:"expressionRule,omitempty"` | |
| Expression *TokenExpressionRule `json:"expression,omitempty"` |
| } | ||
|
|
||
| type TokenRequiredClaim struct { | ||
| // claim is a required field that configures the name of the required claim. |
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.
Not sure I understand why this line is being removed.
| // When taken from the JWT claims, claim must be a string value. | ||
| // | ||
| // claim must not be an empty string (""). | ||
| // |
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.
Also not sure why this line is getting changed.
| // when a token fails validation based on the CEL expression defined in 'Expression'. | ||
| // This field is optional. If provided, the message must be at least 1 character long | ||
| // and cannot exceed 256 characters. This message is logged and not returned to the caller. | ||
|
|
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.
Remove the empty spacing here please.
Spacing is OK as long as it is a continuation of the comment block.
For example:
// This is a comment block.
//
// With a valid separation.is OK.
// This is a comment block.
// With an invalid separation.is not.
No description provided.