@@ -113,13 +113,13 @@ type AuthenticationFilterSpec struct {
113113 Type AuthType ` json:"type"`
114114
115115 // Basic configures HTTP Basic Authentication.
116- // Required when Type == Basic
116+ // Required when Type == Basic.
117117 //
118118 // +optional
119119 Basic *BasicAuth ` json:"basic,omitempty"`
120120
121121 // JWT configures JSON Web Token authentication (NGINX Plus).
122- // Required when Type == JWT
122+ // Required when Type == JWT.
123123 //
124124 // +optional
125125 JWT *JWTAuth ` json:"jwt,omitempty"`
@@ -142,8 +142,9 @@ type BasicAuth struct {
142142 // +optional
143143 SecretRef *SecretObjectReference ` json:"secretRef,omitempty"`
144144
145- // Realm used by NGINX `auth_basic`.
146- // Configures "realm="<realm_value>" in WWW-Authenticate header in error page location.
145+ // Realm used by NGINX `auth_basic` directive.
146+ // https://nginx.org/en/docs/http/ngx_http_auth_basic_module.html#auth_basic
147+ // Also configures "realm="<realm_value>" in WWW-Authenticate header in error page location.
147148 //
148149 // +optional
149150 Realm *string ` json:"realm,omitempty"`
@@ -154,6 +155,15 @@ type BasicAuth struct {
154155 OnFailure *AuthFailureResponse ` json:"onFailure,omitempty"`
155156}
156157
158+ // JWTKeyMode selects where JWT keys come from.
159+ // +kubebuilder:validation:Enum=File;Remote
160+ type JWTKeyMode string
161+
162+ const (
163+ JWTKeyModeFile JWTKeyMode = " File"
164+ JWTKeyModeRemote JWTKeyMode = " Remote"
165+ )
166+
157167// JWTAuth configures JWT-based authentication (NGINX Plus).
158168// +kubebuilder:validation:XValidation:message="mode 'File' requires file set and remote unset",rule="self.mode == 'File' ? self.file != null && self.remote == null : true"
159169// +kubebuilder:validation:XValidation:message="mode 'Remote' requires remote set and file unset",rule="self.mode == 'Remote' ? self.remote != null && self.file == null : true"
@@ -248,15 +258,6 @@ type JWTAuth struct {
248258 Propagation *JWTPropagation ` json:"propagation,omitempty"`
249259}
250260
251- // JWTKeyMode selects where JWT keys come from.
252- // +kubebuilder:validation:Enum=File;Remote
253- type JWTKeyMode string
254-
255- const (
256- JWTKeyModeFile JWTKeyMode = " File"
257- JWTKeyModeRemote JWTKeyMode = " Remote"
258- )
259-
260261// JWTFileKeySource specifies local JWKS key configuration.
261262type JWTFileKeySource struct {
262263 // SecretRef references a Secret containing the JWKS.
@@ -374,6 +375,11 @@ type JWTTokenSource struct {
374375 TokenName string ` json:"tokenName,omitempty"`
375376}
376377
378+ // HeaderValue defines a header name and a value (may reference NGINX variables).
379+ type HeaderValue struct {
380+ Name string ` json:"name"`
381+ ValueFrom string ` json:"valueFrom"`
382+ }
377383
378384// JWTPropagation controls identity header propagation and header stripping.
379385type JWTPropagation struct {
@@ -389,12 +395,6 @@ type JWTPropagation struct {
389395 StripAuthorization *bool ` json:"stripAuthorization,omitempty"`
390396}
391397
392- // HeaderValue defines a header name and a value (may reference NGINX variables).
393- type HeaderValue struct {
394- Name string ` json:"name"`
395- ValueFrom string ` json:"valueFrom"`
396- }
397-
398398// AuthScheme enumerates supported WWW-Authenticate schemes.
399399// +kubebuilder:validation:Enum=Basic;Bearer
400400type AuthScheme string
@@ -900,7 +900,7 @@ spec:
900900 valueFrom: "$jwt_claim_sub"
901901 - name: X-User-Email
902902 valueFrom: "$jwt_claim_email"
903- stripAuthorization: true # Optionally remove client Authorization header
903+ stripAuthorization: true # Optionally remove client Authorization header before proxy_pass
904904` ` `
905905
906906# ## Caching configuration
0 commit comments