You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// +openshift:validation:FeatureGateAwareXValidation:featureGate=ExternalOIDC;ExternalOIDCWithUIDAndExtraClaimMappings,rule="!has(self.spec.oidcProviders) || self.spec.oidcProviders.all(p, !has(p.oidcClients) || p.oidcClients.all(specC, self.status.oidcClients.exists(statusC, statusC.componentNamespace == specC.componentNamespace && statusC.componentName == specC.componentName) || (has(oldSelf.spec.oidcProviders) && oldSelf.spec.oidcProviders.exists(oldP, oldP.name == p.name && has(oldP.oidcClients) && oldP.oidcClients.exists(oldC, oldC.componentNamespace == specC.componentNamespace && oldC.componentName == specC.componentName)))))",message="all oidcClients in the oidcProviders must match their componentName and componentNamespace to either a previously configured oidcClient or they must exist in the status.oidcClients"
8
+
// +openshift:validation:FeatureGateAwareXValidation:featureGate=ExternalOIDC;ExternalOIDCWithUIDAndExtraClaimMappings;ExternalOIDCWithUpstreamParity,rule="!has(self.spec.oidcProviders) || self.spec.oidcProviders.all(p, !has(p.oidcClients) || p.oidcClients.all(specC, self.status.oidcClients.exists(statusC, statusC.componentNamespace == specC.componentNamespace && statusC.componentName == specC.componentName) || (has(oldSelf.spec.oidcProviders) && oldSelf.spec.oidcProviders.exists(oldP, oldP.name == p.name && has(oldP.oidcClients) && oldP.oidcClients.exists(oldC, oldC.componentNamespace == specC.componentNamespace && oldC.componentName == specC.componentName)))))",message="all oidcClients in the oidcProviders must match their componentName and componentNamespace to either a previously configured oidcClient or they must exist in the status.oidcClients"
9
9
10
10
// Authentication specifies cluster-wide settings for authentication (like OAuth and
11
11
// webhook token authenticators). The canonical name of an instance is `cluster`.
@@ -91,6 +91,7 @@ type AuthenticationSpec struct {
// UserValidationRules defines the set of rules used to validate claims in a user's token.
249
+
// Each rule is evaluated independently to determine whether the token subject is considered valid.
250
+
// Rules can either require specific claims and values to be present,
251
+
// or define CEL expressions that must evaluate to true for the token to be accepted.
252
+
// If the expression in a rule evaluates to false, the token is rejected.
253
+
// At least one rule must evaluate to true for the token to be considered valid.
254
+
// A maximum of 64 rules can be specified. This field is optional.
255
+
//
256
+
// See https://kubernetes.io/docs/reference/using-api/cel/ for CEL syntax.
257
+
// +listType=atomic
258
+
// +kubebuilder:validation:MaxItems=64
259
+
// +kubebuilder:validation:XValidation:rule="self.size() == 0 || <feature-gate-enabled-check>",message="user validation rules are not supported when StructuredAuthenticationConfiguration feature gate is disabled"
260
+
// +kubebuilder:validation:XValidation:rule="self.all(x, x.expression.size() > 0)",message="each expression must be non-empty"
261
+
// +kubebuilder:validation:XValidation:rule="self.map(x, x.expression).countDistinct() == self.size()",message="expressions must be unique"
// +openshift:validation:FeatureGateAwareXValidation:featureGate=ExternalOIDCWithUpstreamParity,rule="self.?discoveryURL.orValue(\"\").size() > 0 ? (self.issuerURL.size() == 0 || self.discoveryURL.find('^.+[^/]') != self.issuerURL.find('^.+[^/]')) : true",message="discoveryURL must be different from issuerURL"
251
271
typeTokenIssuerstruct {
252
272
// issuerURL is a required field that configures the URL used to issue tokens
// TokenValidationRuleRequiredClaim indicates that the token must contain a specific claim.
792
+
// Used as a value for TokenValidationRuleType.
793
+
TokenValidationRuleRequiredClaim="RequiredClaim"
794
+
// TokenValidationRuleExpression indicates that the token validation is defined via a CEL expression.
795
+
// Used as a value for TokenValidationRuleType.
796
+
TokenValidationRuleExpression="Expression"
727
797
)
728
798
799
+
// TokenClaimValidationRule represents a validation rule based on token claims.
800
+
// If type is RequiredClaim, requiredClaim must be set.
801
+
// If type is Expression, expressionRule must be set.
802
+
//
803
+
// +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'RequiredClaim' ? has(self.requiredClaim) : !has(self.requiredClaim)",message="requiredClaim must be set when type is 'RequiredClaim', and forbidden otherwise"
804
+
// +openshift:validation:FeatureGateAwareXValidation:featureGate=ExternalOIDCWithUpstreamParity,rule="has(self.type) && self.type == 'Expression' ? has(self.expressionRule) : !has(self.expressionRule)",message="expressionRule must be set when type is 'Expression', and forbidden otherwise"
729
805
typeTokenClaimValidationRulestruct {
730
806
// type is an optional field that configures the type of the validation rule.
731
807
//
732
-
// Allowed values are 'RequiredClaim' and omitted (not provided or an empty string).
808
+
// Allowed values are "RequiredClaim" and "Expression".
733
809
//
734
-
// When set to 'RequiredClaim', the Kubernetes API server
735
-
// will be configured to validate that the incoming JWT
736
-
// contains the required claim and that its value matches
737
-
// the required value.
810
+
// When set to 'RequiredClaim', the Kubernetes API server will be configured
811
+
// to validate that the incoming JWT contains the required claim and that its
812
+
// value matches the required value.
738
813
//
739
-
// Defaults to 'RequiredClaim'.
740
-
//
741
-
// +kubebuilder:validation:Enum={"RequiredClaim"}
742
-
// +kubebuilder:default="RequiredClaim"
814
+
// When set to 'Expression', the Kubernetes API server will be configured
815
+
// to validate the incoming JWT against the configured CEL expression.
743
816
TypeTokenValidationRuleType`json:"type"`
744
817
745
-
// requiredClaim is an optional field that configures the required claim
746
-
// and value that the Kubernetes API server will use to validate if an incoming
747
-
// JWT is valid for this identity provider.
748
-
//
818
+
// requiredClaim allows configuring a required claim name and its expected value.
819
+
// When type is RequiredClaim, this field is used by the Kubernetes API server
820
+
// to validate if an incoming JWT is valid for this identity provider.
0 commit comments