Skip to content

Commit

Permalink
OCPBUGS-36809: Add missing auth config fields
Browse files Browse the repository at this point in the history
The `uid` and `extra` fields were added to Kubernetes in 1.29.
These fields should be included in OpenShift as well.
  • Loading branch information
jonesbr17 committed Jul 10, 2024
1 parent 0689f00 commit a288b0d
Show file tree
Hide file tree
Showing 5 changed files with 217 additions and 1 deletion.
31 changes: 31 additions & 0 deletions config/v1/types_authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,14 @@ type TokenClaimMappings struct {
// groups for the cluster identity.
// The referenced claim must use array of strings values.
Groups PrefixedClaimMapping `json:"groups,omitempty"`

// UID reqresents an option for the uid attribute.
// +optional
UID ClaimOrExpression `json:"uid"`

// Extra represents an option for the extra attribute
// +optional
Extra []ExtraMapping `json:"extra"`
}

type TokenClaimMapping struct {
Expand Down Expand Up @@ -481,3 +489,26 @@ type TokenRequiredClaim struct {
// +required
RequiredValue string `json:"requiredValue"`
}

type ClaimOrExpression struct {
// Claim is the JWT claim to use.
// Mutually exclusive with expression.
// +optional
Claim string `json:"claim"`

// Expression respresents a CEL expression.
// Mutually exclusive with claim.
// +optional
Expression string `json:"expression"`
}

type ExtraMapping struct {
// Key is a string to use as the extra attribute key
// key must be lowercase and unique
// +required
Key string `json:"key"`

// ValueExpression is a CEL expression to extract extra attribute value
// +required
ValueExpression string `json:"valueExpression"`
}
38 changes: 38 additions & 0 deletions config/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions config/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 81 additions & 1 deletion openapi/generated_openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4940,6 +4940,21 @@
}
}
},
"com.github.openshift.api.config.v1.ClaimOrExpression": {
"type": "object",
"properties": {
"claim": {
"description": "Claim is the JWT claim to use. Mutually exclusive with expression.",
"type": "string",
"default": ""
},
"expression": {
"description": "Expression respresents a CEL expression. Mutually exclusive with claim.",
"type": "string",
"default": ""
}
}
},
"com.github.openshift.api.config.v1.ClientConnectionOverrides": {
"type": "object",
"required": [
Expand Down Expand Up @@ -6159,6 +6174,25 @@
}
}
},
"com.github.openshift.api.config.v1.ExtraMapping": {
"type": "object",
"required": [
"key",
"valueExpression"
],
"properties": {
"key": {
"description": "Key is a string to use as the extra attribute key key must be lowercase and unique",
"type": "string",
"default": ""
},
"valueExpression": {
"description": "ValueExpression is a CEL expression to extract extra attribute value",
"type": "string",
"default": ""
}
}
},
"com.github.openshift.api.config.v1.FeatureGate": {
"description": "Feature holds cluster-wide information about feature gates. The canonical name is `cluster`\n\nCompatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).",
"type": "object",
Expand Down Expand Up @@ -10290,11 +10324,24 @@
"com.github.openshift.api.config.v1.TokenClaimMappings": {
"type": "object",
"properties": {
"extra": {
"description": "Extra represents an option for the extra attribute",
"type": "array",
"items": {
"default": {},
"$ref": "#/definitions/com.github.openshift.api.config.v1.ExtraMapping"
}
},
"groups": {
"description": "Groups is a name of the claim that should be used to construct groups for the cluster identity. The referenced claim must use array of strings values.",
"default": {},
"$ref": "#/definitions/com.github.openshift.api.config.v1.PrefixedClaimMapping"
},
"uid": {
"description": "UID reqresents an option for the uid attribute.",
"default": {},
"$ref": "#/definitions/com.github.openshift.api.config.v1.ClaimOrExpression"
},
"username": {
"description": "Username is a name of the claim that should be used to construct usernames for the cluster identity.\n\nDefault value: \"sub\"",
"default": {},
Expand Down

0 comments on commit a288b0d

Please sign in to comment.