Skip to content

Commit 6059d18

Browse files
committed
KEP-3331: add audienceMatchPolicy to authentication config
Signed-off-by: Anish Ramasekar <[email protected]>
1 parent ee39cec commit 6059d18

File tree

1 file changed

+17
-2
lines changed
  • keps/sig-auth/3331-structured-authentication-configuration

1 file changed

+17
-2
lines changed

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ jwt:
207207
url: https://example.com
208208
audiences:
209209
- my-app
210+
- other-app
211+
audienceMatchPolicy: MatchAny
210212
claimValidationRules:
211213
- claim: hd
212214
requiredValue: example.com
@@ -343,7 +345,7 @@ type JWTAuthenticator struct {
343345
//
344346
// Example:
345347
// A discovery url that is exposed using kubernetes service 'oidc' in namespace 'oidc-namespace'.
346-
// certificateAuthority is used to verify the TLS connection and the hostname on the leaf certifcation
348+
// certificateAuthority is used to verify the TLS connection and the hostname on the leaf certificate
347349
// must be set to 'oidc.oidc-namespace'.
348350
//
349351
// curl https://oidc.oidc-namespace (.discoveryURL field)
@@ -365,10 +367,23 @@ type JWTAuthenticator struct {
365367
CertificateAuthority string `json:"certificateAuthority,omitempty"`
366368

367369
// audiences is the set of acceptable audiences the JWT must be issued to.
368-
// At least one of the entries must match the "aud" claim in presented JWTs.
369370
// Same value as the --oidc-client-id flag (though this field supports an array).
370371
// Required to be non-empty.
371372
Audiences []string `json:"audiences,omitempty"`
373+
374+
// audienceMatchPolicy defines how the "audiences" field is used to match the "aud" claim in the presented JWT.
375+
// Allowed values are:
376+
// 1. "MatchAny" when multiple audiences are specified and
377+
// 2. empty (or unset) or "MatchAny" when a single audience is specified.
378+
//
379+
// - MatchAny: the "aud" claim in the presented JWT must match at least one of the entries in the "audiences" field.
380+
// For example, if "audiences" is ["foo", "bar"], the "aud" claim in the presented JWT must contain either "foo" or "bar" (and may contain both).
381+
//
382+
// - "": The match policy can be empty (or unset) when a single audience is specified in the "audiences" field. The "aud" claim in the presented JWT must contain the single audience (and may contain others).
383+
//
384+
// For more nuanced audience validation, use claimValidationRules.
385+
// example: claimValidationRule[].expression: 'sets.equivalent(claims.aud, ["bar", "foo", "baz"])' to require an exact match.
386+
AudienceMatchPolicy AudienceMatchPolicy `json:"audienceMatchPolicy"`
372387
}
373388
```
374389

0 commit comments

Comments
 (0)