Skip to content

Commit 14b84a9

Browse files
committed
Use SecretObjectReference for secretRef, remove references to ConfigMapRef, don't default to File mode
1 parent dd24287 commit 14b84a9

File tree

1 file changed

+8
-69
lines changed

1 file changed

+8
-69
lines changed

docs/proposals/authentication-filter.md

Lines changed: 8 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,7 @@ type JWTAuth struct {
168168
// Mode selects how JWT keys are provided: local file or remote JWKS.
169169
Mode JWTKeyMode `json:"mode,omitempty"`
170170

171-
// File specifies local JWKS configuration (Secret or ConfigMap, mount path, file name).
172-
// Required when Mode == File. Exactly one of ConfigMapRef or SecretRef must be set.
171+
// File specifies local JWKS configuration.
173172
//
174173
// +optional
175174
File *JWTFileKeySource `json:"file,omitempty"`
@@ -252,16 +251,12 @@ const (
252251
)
253252

254253
// JWTFileKeySource specifies local JWKS key configuration.
255-
// +kubebuilder:validation:XValidation:message="exactly one of configMapRef or secretRef must be set",rule="(self.configMapRef == null) != (self.secretRef == null)"
256254
type JWTFileKeySource struct {
257-
// SecretRef references a Secret containing the JWKS (with optional key).
258-
// Exactly one of ConfigMapRef or SecretRef must be set.
259-
//
260-
// +optional
261-
SecretRef *SecretObjectReference `json:"secretRef,omitempty"`
255+
// SecretRef references a Secret containing the JWKS.
256+
SecretRef SecretObjectReference `json:"secretRef,omitempty"`
262257

263258
// KeyCache is the cache duration for keys.
264-
// Configures `auth_jwt_key_cache` directive
259+
// Configures `auth_jwt_key_cache` directive.
265260
// Example: "auth_jwt_key_cache 10m;".
266261
//
267262
// +optional
@@ -406,8 +401,8 @@ type AuthFailureBodyPolicy string
406401

407402
const (
408403
AuthFailureBodyPolicyUnauthorized AuthFailureBodyPolicy = "Unauthorized"
409-
AuthFailureBodyPolicyForbidden AuthFailureBodyPolicy = "Forbidden"
410-
AuthFailureBodyPolicyEmpty AuthFailureBodyPolicy = "Empty"
404+
AuthFailureBodyPolicyForbidden AuthFailureBodyPolicy = "Forbidden"
405+
AuthFailureBodyPolicyEmpty AuthFailureBodyPolicy = "Empty"
411406
)
412407

413408
// AuthFailureResponse customizes 401/403 failures.
@@ -435,16 +430,6 @@ type AuthFailureResponse struct {
435430
BodyPolicy *AuthFailureBodyPolicy `json:"bodyPolicy,omitempty"`
436431
}
437432

438-
// NamespacedSecretKeyReference references a Secret and optional key, with an optional namespace.
439-
// If namespace differs from the filter's, a ReferenceGrant in the target namespace is required.
440-
type NamespacedSecretKeyReference struct {
441-
// +optional
442-
Namespace *string `json:"namespace,omitempty"`
443-
Name string `json:"name"`
444-
// +optional
445-
Key *string `json:"key,omitempty"`
446-
}
447-
448433
// AuthenticationFilterStatus defines the state of AuthenticationFilter.
449434
type AuthenticationFilterStatus struct {
450435
// Controllers is a list of Gateway API controllers that processed the AuthenticationFilter
@@ -635,7 +620,7 @@ spec:
635620
type: JWT
636621
jwt:
637622
realm: "Restricted"
638-
# Key verification mode: Local file or Remote JWKs
623+
# Key verification mode. Local file or Remote JWKs
639624
mode: Remote
640625
remote:
641626
url: https://issuer.example.com/.well-known/jwks.json
@@ -650,17 +635,6 @@ spec:
650635
scheme: Bearer
651636
```
652637
653-
#### ConfigMap referenced by filter (if using configMapRef)
654-
655-
```yaml
656-
apiVersion: v1
657-
kind: ConfigMap
658-
metadata:
659-
name: jwt-keys
660-
data:
661-
jwks.json: ewogICJrZXlzIjogWwogICAgewogICAgICAia3R5IjogIlJTQSIsCiAgICAgICJ1c2UiOiAic2lnIiwKICAgICAgImtpZCI6ICJleGFtcGxlLWtleS1pZCIsCiAgICAgICJhbGciOiAiUlMyNTYiLAogICAgICAibiI6ICJiYXNlNjR1cmwtbW9kdWx1cyIsCiAgICAgICJlIjogIkFRQUIiCiAgICB9CiAgXQp9Cg==
662-
```
663-
664638
#### Secret referenced by filter (if using secretRef)
665639
666640
```yaml
@@ -1067,48 +1041,13 @@ spec:
10671041
realm: "Restricted"
10681042
```
10691043

1070-
Example: Grant JWT file-based JWKS in keys-ns to filter in app-ns
1071-
```yaml
1072-
apiVersion: gateway.networking.k8s.io/v1
1073-
kind: ReferenceGrant
1074-
metadata:
1075-
name: allow-jwks-configmap
1076-
namespace: keys-ns
1077-
spec:
1078-
from:
1079-
- group: gateway.nginx.org
1080-
kind: AuthenticationFilter
1081-
namespace: app-ns
1082-
to:
1083-
- group: "" # core API group
1084-
kind: ConfigMap
1085-
name: jwt-keys
1086-
```
1087-
1088-
AuthenticationFilter referencing cross-namespace JWKS ConfigMap
1089-
```yaml
1090-
apiVersion: gateway.nginx.org/v1alpha1
1091-
kind: AuthenticationFilter
1092-
metadata:
1093-
name: jwt-auth
1094-
namespace: app-ns
1095-
spec:
1096-
type: JWT
1097-
jwt:
1098-
mode: File
1099-
file:
1100-
configMapRef:
1101-
namespace: keys-ns
1102-
name: jwt-keys
1103-
```
1104-
11051044
### Remote JWKS
11061045

11071046
Proxy cache TTL should be configurable and set to a reasonable default, reducing periods of stale cached JWKs.
11081047

11091048
### Key rotation
11101049

1111-
Users should be advised to regularly rotate their JWKS keys in cases where they chose to reference a local JWKS via a `secrefRef` or `configMapRef`
1050+
Users should be advised to regularly rotate their JWKS keys in cases where they chose to reference a local JWKS via a `secrefRef`
11121051

11131052
### Auth failure behaviour
11141053

0 commit comments

Comments
 (0)