Skip to content
Open
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d91a5f4
Add Implementable Proposal for AuthenticationFilter
shaun-nx Nov 6, 2025
9047c3e
Update auth header code block
shaun-nx Nov 6, 2025
c937366
Fix pre-commit and lint errors
shaun-nx Nov 6, 2025
1b8bac2
Update Golang API with defaults and CEL validation with kubebuilder
shaun-nx Nov 7, 2025
2f143e9
Add additional defaults and CEL validations
shaun-nx Nov 7, 2025
61f479c
Merge branch 'main' into proposal/authentication-filter
shaun-nx Nov 7, 2025
47ff38b
Fix typos
shaun-nx Nov 7, 2025
40b8224
Update comments in GolangAPI to decribe relative NGINX directives
shaun-nx Nov 7, 2025
24966b8
Update API and Security Considerations for ReferenceGrant integration
shaun-nx Nov 7, 2025
ecceb93
Merge branch 'main' into proposal/authentication-filter
shaun-nx Nov 7, 2025
da1b17e
Fix pre-commit errors
shaun-nx Nov 7, 2025
38dd8f7
Fix typos and grammer
shaun-nx Nov 7, 2025
e362745
Update BasicAuth AIP and examples to use `secretRef`
shaun-nx Nov 7, 2025
dd5aaa8
Update KeyCache to use v1alpha1.Duration
shaun-nx Nov 7, 2025
bf3ed2b
Merge branch 'main' into proposal/authentication-filter
shaun-nx Nov 14, 2025
eb49b32
Merge branch 'main' into proposal/authentication-filter
shaun-nx Nov 18, 2025
a86a3ae
Move kubebuilder validation, remove mountpath and configmap options, …
shaun-nx Nov 18, 2025
79b957d
Update jwks_uri internal uri
shaun-nx Nov 19, 2025
e0ec4fb
Fix typos
shaun-nx Nov 19, 2025
d3ebed4
Fix comment indentation
shaun-nx Nov 19, 2025
4f1c893
Adjust struct indentation
shaun-nx Nov 19, 2025
5ff7389
Pre-commit check
shaun-nx Nov 19, 2025
dd24287
Ensure no default for JWT key mode
shaun-nx Nov 19, 2025
14b84a9
Use SecretObjectReference for secretRef, remove references to ConfigM…
shaun-nx Nov 19, 2025
8526c7f
Add references to NGINX directives
shaun-nx Nov 19, 2025
93486eb
Remove `key` from `secretRef`
shaun-nx Nov 19, 2025
d91b389
Remove trailing whitespace
shaun-nx Nov 19, 2025
b6fb76b
Add additional comments
shaun-nx Nov 19, 2025
73594af
Update comments and restructure api
shaun-nx Nov 19, 2025
7aede4c
Update security details on headers
shaun-nx Nov 19, 2025
acbb54c
Merge branch 'main' into proposal/authentication-filter
shaun-nx Nov 19, 2025
4aae8e7
Merge branch 'main' into proposal/authentication-filter
shaun-nx Nov 20, 2025
1029c3e
Remove JWT key word from fields
shaun-nx Nov 20, 2025
c864630
Add default Real for basic auth
shaun-nx Nov 20, 2025
ef57f2a
Fix typo
shaun-nx Nov 20, 2025
22d2726
Update Status section on using NGINX OSS with JWT auth
shaun-nx Nov 20, 2025
9e6b3c9
Set optioanl JWT fields as stretch goals
shaun-nx Nov 20, 2025
21b5611
Add stretch goals
shaun-nx Nov 20, 2025
65c1adc
Update secret ref to use LocalObjectReferenceWithKey struct
shaun-nx Nov 20, 2025
a0c8c04
Fix typo and update validation section
shaun-nx Nov 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 49 additions & 53 deletions docs/proposals/authentication-filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,8 @@ const (

// BasicAuth configures HTTP Basic Authentication.
type BasicAuth struct {
// SecretRef allows referencing a Secret in the same or different namespace.
// When namespace is set and differs from the filter's namespace, a ReferenceGrant in the target namespace is required.
//
// +optional
SecretRef *SecretObjectReference `json:"secretRef,omitempty"`
// SecretRef allows referencing a Secret in the same namespace
SecretRef LocalObjectReferenceWithKey `json:"secretRef,omitempty"`

// Realm used by NGINX `auth_basic` directive.
// https://nginx.org/en/docs/http/ngx_http_auth_basic_module.html#auth_basic
Expand Down Expand Up @@ -230,7 +227,7 @@ type JWTAuth struct {
// FileKeySource specifies local JWKS key configuration.
type FileKeySource struct {
// SecretRef references a Secret containing the JWKS.
SecretRef SecretObjectReference `json:"secretRef,omitempty"`
SecretRef LocalObjectReferenceWithKey `json:"secretRef,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not use SecretRef as the name either, for flexibility.


// KeyCache is the cache duration for keys.
// Configures `auth_jwt_key_cache` directive.
Expand All @@ -241,6 +238,13 @@ type FileKeySource struct {
KeyCache *v1alpha1.Duration `json:"keyCache,omitempty"`
}

// LocalObjectReferenceWithKey sepcifies as local kubernetes object
// with required `key` field to extract data.
type LocalObjectReferenceWithKey struct {
v1.LocalObjectReference
Key string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we set a default key that we can use in our docs so users don't have to specify this unless they explicitly change it.

}

// RemoteKeySource specifies remote JWKS configuration.
type RemoteKeySource struct {
// URL is the JWKS endpoint, e.g. "https://issuer.example.com/.well-known/jwks.json".
Expand Down Expand Up @@ -395,6 +399,7 @@ spec:
basic:
secretRef:
name: basic-auth-users # Secret containing htpasswd data
key: htpasswd
realm: "Restricted" # Optional. Helps with logging
onFailure: # Optional. These setting may be defaults.
statusCode: 401
Expand Down Expand Up @@ -512,6 +517,7 @@ spec:
file:
secretRef:
name: jwt-keys-secure
key: jwks.json
keyCache: 10m # Optional cache time for keys (auth_jwt_key_cache)
# Acceptable clock skew for exp/nbf
leeway: 60s # Configures auth_jwt_leeway
Expand Down Expand Up @@ -859,52 +865,6 @@ Users that attach an `AuthenticationFilter` to an HTTPRoute/GRPCRoute should be

Any example configurations and deployments for the `AuthenticationFilter` should enable HTTPS at the Gateway level by default.

### Namespace isolataion and cross-namespace references
Both Auth and Local JWKS should only have access to Secrets and ConfigMaps in the same namespace by default.

Cross-namespace references are allowed only when authorized via a Gateway API ReferenceGrant in the target namespace.

Controller behavior:
- Same-namespace references are permitted without a grant.
- For cross-namespace references, the controller MUST verify a ReferenceGrant exists in the target namespace:
- from: group=gateway.nginx.org, kind=AuthenticationFilter, namespace=<filter-namespace>
- to: group="", kind=(Secret|ConfigMap), name=<target-name>
- If no valid grant is found, the filter status should update the status to `Accepted=False` with `reason=RefNotPermitted` and a clear message. We should avoid rendering any NGINX configuration in this scenario.

Example: Grant BasicAuth in app-ns to read a Secret in security-ns
```yaml
apiVersion: gateway.networking.k8s.io/v1
kind: ReferenceGrant
metadata:
name: allow-basic-auth-secret
namespace: security-ns # target namespace where the Secret lives
spec:
from:
- group: gateway.nginx.org
kind: AuthenticationFilter
namespace: app-ns
to:
- group: "" # core API group
kind: Secret
name: basic-auth-users
```

AuthenticationFilter referencing the cross-namespace Secret
```yaml
apiVersion: gateway.nginx.org/v1alpha1
kind: AuthenticationFilter
metadata:
name: basic-auth
namespace: app-ns
spec:
type: Basic
basic:
secretRef:
namespace: security-ns
name: basic-auth-users
realm: "Restricted"
```

### Remote JWKS

Proxy cache TTL should be configurable and set to a reasonable default, reducing periods of stale cached JWKs.
Expand Down Expand Up @@ -981,7 +941,7 @@ document that behavior.

## Stretch Goals

### Cross namespace acess
### Cross namespace access

When referencing secrets for Basic Auth and JWT Auth, the initial implementation will use `LocalObjectReference`.

Expand All @@ -1001,6 +961,42 @@ type NamespacedSecretKeyReference struct {
}
```

For initial implementaion, both Basic Auth and Local JWKS should will only have access to Secrets in the same namespace.

Example: Grant BasicAuth in app-ns to read a Secret in security-ns
```yaml
Comment on lines +968 to +969
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Example: Grant BasicAuth in app-ns to read a Secret in security-ns
```yaml
Example: Grant BasicAuth in app-ns to read a Secret in security-ns
```yaml

apiVersion: gateway.networking.k8s.io/v1
kind: ReferenceGrant
metadata:
name: allow-basic-auth-secret
namespace: security-ns # target namespace where the Secret lives
spec:
from:
- group: gateway.nginx.org
kind: AuthenticationFilter
namespace: app-ns
to:
- group: "" # core API group
kind: Secret
name: basic-auth-users
```

AuthenticationFilter referencing the cross-namespace Secret
```yaml
Comment on lines +986 to +987
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AuthenticationFilter referencing the cross-namespace Secret
```yaml
AuthenticationFilter referencing the cross-namespace Secret
```yaml

apiVersion: gateway.nginx.org/v1alpha1
kind: AuthenticationFilter
metadata:
name: basic-auth
namespace: app-ns
spec:
type: Basic
basic:
secretRef:
namespace: security-ns
name: basic-auth-users
realm: "Restricted"
```

### Additional Fields for JWT

`require`, `tokenSource` and `propagation` are some additional fields that may be incldued in future updates to the API.
Expand Down
Loading