Skip to content

Commit 7b7c915

Browse files
committed
KEP-3331: update fields to reflect alpha implementation
Signed-off-by: Anish Ramasekar <[email protected]>
1 parent e0ae0a8 commit 7b7c915

File tree

1 file changed

+16
-12
lines changed
  • keps/sig-auth/3331-structured-authentication-configuration

1 file changed

+16
-12
lines changed

keps/sig-auth/3331-structured-authentication-configuration/README.md

+16-12
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,10 @@ jwt:
224224
extra:
225225
- key: 'client_name'
226226
valueExpression: 'claims.some_claim'
227-
userInfoValidationRules:
228-
- rule: "!userInfo.username.startsWith('system:')"
227+
userValidationRules:
228+
- expression: "!user.username.startsWith('system:')"
229229
message: username cannot used reserved system: prefix
230-
- rule: "userInfo.groups.all(group, !group.startsWith('system:'))"
230+
- expression: "user.groups.all(group, !group.startsWith('system:'))"
231231
message: groups cannot used reserved system: prefix
232232
```
233233
@@ -273,7 +273,7 @@ TODO: mermaid diagram
273273
- TODO enumerate these
274274
2. Claim validation based on `claimValidationRules`
275275
3. Claim mapping based on `claimMappings`
276-
4. User info validation based on `userInfoValidationRules`
276+
4. User validation based on `userValidationRules`
277277

278278
```go
279279
type AuthenticationConfiguration struct {
@@ -315,11 +315,11 @@ type JWTAuthenticator struct {
315315
// +optional
316316
// ClaimsFilter []string `json:"claimFilters,omitempty"`
317317

318-
// userInfoValidationRules are rules that are applied to final userInfo before completing authentication.
318+
// userValidationRules are rules that are applied to final userInfo before completing authentication.
319319
// These allow invariants to be applied to incoming identities such as preventing the
320320
// use of the system: prefix that is commonly used by Kubernetes components.
321321
// +optional
322-
UserInfoValidationRules []UserInfoValidationRule `json:"userInfoValidationRules,omitempty"`
322+
UserValidationRules []UserValidationRule `json:"userValidationRules,omitempty"`
323323
}
324324
```
325325

@@ -477,8 +477,6 @@ type JWTAuthenticator struct {
477477
// - key: "admin"
478478
// valueExpression: '(has(claims.is_admin) && claims.is_admin) ? "true":""'
479479
//
480-
// If multiple mappings have the same key, the result will be a concatenation of all values
481-
// with the order preserved.
482480
// If the value is empty, the extra mapping will not be present.
483481
//
484482
// possible future way to pull multiple extra values out via expression.
@@ -493,6 +491,12 @@ type JWTAuthenticator struct {
493491
494492
type ExtraMapping struct {
495493
// key is a string to use as the extra attribute key.
494+
// key must be a domain-prefix path (e.g. example.org/foo). All characters before the first "/" must be a valid
495+
// subdomain as defined by RFC 1123. All characters trailing the first "/" must
496+
// be valid HTTP Path characters as defined by RFC 3986.
497+
// key must be lowercase.
498+
// key must be unique across all extra mappings.
499+
// +required
496500
Key string `json:"key"`
497501
// valueExpression is a CEL expression to extract extra attribute value.
498502
// valueExpression must produce a string or string array value.
@@ -520,10 +524,10 @@ type JWTAuthenticator struct {
520524
// prefix is prepended to claim to prevent clashes with existing names.
521525
// Mutually exclusive with expression.
522526
// +optional
523-
Prefix string `json:"prefix"`
527+
Prefix *string `json:"prefix"`
524528
525529
// expression represents the expression which will be evaluated by CEL.
526-
// Must produce a string. CEL expressions have access to the contents of the token claims for claimValidationRules and claimMappings, userInfo for userInfoValidationRules. Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/
530+
// Must produce a string. CEL expressions have access to the contents of the token claims for claimValidationRules and claimMappings, user for userValidationRules. Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/
527531
// Either claim or expression must be set.
528532
// +optional
529533
Expression string `json:"expression"`
@@ -593,8 +597,8 @@ type JWTAuthenticator struct {
593597
* There will be a maximum allowed CEL expression cost per authenticator (no limit on total authenticators is required due to the issuer uniqueness requirement).
594598
* One variable will be available to use in `claimValidationRules` and `claimMappings`:
595599
* `claims` for JWT claims (payload)
596-
* One variable will be available to use in `userInfoValidationRules`:
597-
* `userInfo` with the same schema as [authentication.k8s.io/v1, Kind=UserInfo](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#userinfo-v1-authentication-k8s-io)
600+
* One variable will be available to use in `userValidationRules`:
601+
* `user` with the same schema as [authentication.k8s.io/v1, Kind=UserInfo](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#userinfo-v1-authentication-k8s-io)
598602
* The standard Kubernetes CEL environment, including extension libraries, will be used.
599603
* Current environment:
600604
* [Extension libraries](https://github.com/kubernetes/kubernetes/blob/5fe3563ad7e04d5470368aa821f42f131d3bd8fc/staging/src/k8s.io/apiserver/pkg/cel/library/libraries.go#L26)

0 commit comments

Comments
 (0)