@@ -130,7 +130,7 @@ Items marked with (R) are required *prior to targeting to a milestone / release*
130
130
131
131
This enhancement proposal covers adding structured authentication configuration to the Kubernetes API server.
132
132
Initially, only a ` jwt ` configuration will be supported, which will serve as the next iteration of the existing
133
- OIDC authenticator. OIDC authentication is important part of Kubernetes, yet it has limitations in its current state.
133
+ OIDC authenticator. OIDC authentication is an important part of Kubernetes, yet it has limitations in its current state.
134
134
Below we will discuss that limitation and propose solutions.
135
135
136
136
# Motivation
@@ -223,10 +223,8 @@ jwt:
223
223
uid :
224
224
claim : ' sub'
225
225
extra :
226
- - key :
227
- constant : ' client_name' # TODO: decide if we really need this flexibility or can we just have constant keys
228
- value :
229
- claim : ' aud'
226
+ - key : ' client_name'
227
+ valueExpression : ' claims.some_claim'
230
228
# TODO(enj): drop this and figure out to get from CEL
231
229
# claimFilters:
232
230
# - username
@@ -260,8 +258,6 @@ is `sub` required or is the requirement to just have some username field?
260
258
Payloads with nested data are supported as well (it will be possible
261
259
to use the `foo` value as a claim mapping) :
262
260
263
- TODO(aramase) : validate if CEL can work with multiple level of nesting
264
-
265
261
` ` ` json
266
262
{
267
263
"custom": {
@@ -290,7 +286,7 @@ type AuthenticationConfiguration struct {
290
286
291
287
// jwt is a list of OIDC providers to authenticate Kubernetes users.
292
288
// For an incoming token, each JWT authenticator will be attempted in
293
- // the order in which it is specifcied in this list. Note however that
289
+ // the order in which it is specified in this list. Note however that
294
290
// other authenticators may run before or after the JWT authenticators.
295
291
// The specific position of JWT authenticators in relation to other
296
292
// authenticators is neither defined nor stable across releases. Since
@@ -325,7 +321,7 @@ type JWTAuthenticator struct {
325
321
// ClaimsFilter []string `json:"claimFilters,omitempty"`
326
322
327
323
// userInfoValidationRules are rules that are applied to final userInfo before completing authentication.
328
- // These allow invariants to be applied to incoming identites such as preventing the
324
+ // These allow invariants to be applied to incoming identities such as preventing the
329
325
// use of the system: prefix that is commonly used by Kubernetes components.
330
326
// +optional
331
327
UserInfoValidationRules []UserInfoValidationRule ` json:"userInfoValidationRules,omitempty"`
@@ -446,36 +442,38 @@ type JWTAuthenticator struct {
446
442
UID ClaimOrExpression ` json:" uid,omitempty" `
447
443
// Extra represents an option for the extra attribute.
448
444
//
449
- // TODO: examples for this?
445
+ // # hard-coded extra key/value
446
+ // - key: "foo"
447
+ // valueExpression: "bar"
448
+ //
449
+ // hard-coded key, value copying claim value
450
+ // - key: "foo"
451
+ // valueExpression: "claims.some_claim"
450
452
//
451
- // # known key, value from claim
452
- // - key: "example.com/myextrakey"
453
- // value:
454
- // claim: "hd"
453
+ // hard-coded key, value derived from claim value
454
+ // - key: "admin"
455
+ // valueExpression: '(has(claims.is_admin) && claims.is_admin) ? "true":""'
455
456
//
456
- // # known key, value constructed by expression
457
- // - key: "example.com/myextrakey"
458
- // value:
459
- // expression: claims.someclaim+":"+claims.someclaim
457
+ // If multiple mappings have the same key, the result will be a concatenation of all values.
458
+ // If the value is empty, the extra mapping will not be present.
460
459
//
461
- // # calculated key/value pairs? CEL returns [{key,value}, {key,[value, value...]}, ...] and we aggregate?
462
- // TODO: ask joe/cici about CEL constructing/returning complex types
460
+ // possible future way to pull multiple extra values out via expression.
461
+ // TODO: confirm cel comprehensions/mapping is powerful enough to transform
462
+ // the input claims into a filtered / transformed map[string][]string output):
463
+ // # mutually exclusive with key/valueExpression
464
+ // keyAndValueExpression: '{"key":"string-value", "key2": ["value1","value2"]}'
463
465
//
464
466
// +optional
465
467
Extra []ExtraMapping ` json:" extra,omitempty" `
466
468
}
467
469
468
470
type ExtraMapping struct {
469
- // Key is a CEL expression to extract extra attribute key.
470
- // Claim must be a singular string claim.
471
+ // Key is a string to use as the extra attribute key.
472
+ Key string ` json:" key" `
473
+ // ValueExpression is a CEL expression to extract extra attribute value.
471
474
// Expression must produce a string value.
472
475
// "" and null values are treated as the extra mapping not being present.
473
- Key string ` json:" key" `
474
- // Value is a CEL expression to extract extra attribute value.
475
- // Claim must be a string or string array claim.
476
- // Expression must produce a string or string array value.
477
- // "", [], and null values are treated as the extra mapping not being present.
478
- Value ClaimOrExpression ` json:" value" `
476
+ ValueExpression string ` json:" valueExpression" `
479
477
}
480
478
481
479
type ClaimOrExpression struct {
0 commit comments