diff --git a/api/v1alpha1/basic_auth_types.go b/api/v1alpha1/basic_auth_types.go index f7bec28378..cc98c1e6f0 100644 --- a/api/v1alpha1/basic_auth_types.go +++ b/api/v1alpha1/basic_auth_types.go @@ -26,4 +26,13 @@ type BasicAuth struct { // // Note: The secret must be in the same namespace as the SecurityPolicy. Users gwapiv1.SecretObjectReference `json:"users"` + + // This field specifies the header name to forward a successfully authenticated user to + // the backend. The header will be added to the request with the username as the value. + // + // If it is not specified, the username will not be forwarded. + // + // +optional + // +notImplementedHide + ForwardUsernameHeader *string `json:"forwardUsernameHeader,omitempty"` } diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 97fddd3ff6..bbb7c11455 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -653,6 +653,11 @@ func (in *BackendTrafficPolicySpec) DeepCopy() *BackendTrafficPolicySpec { func (in *BasicAuth) DeepCopyInto(out *BasicAuth) { *out = *in in.Users.DeepCopyInto(&out.Users) + if in.ForwardUsernameHeader != nil { + in, out := &in.ForwardUsernameHeader, &out.ForwardUsernameHeader + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BasicAuth. diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml index a48bc49ec9..6aa0d9dce2 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -384,6 +384,13 @@ spec: description: BasicAuth defines the configuration for the HTTP Basic Authentication. properties: + forwardUsernameHeader: + description: |- + This field specifies the header name to forward a successfully authenticated user to + the backend. The header will be added to the request with the username as the value. + + If it is not specified, the username will not be forwarded. + type: string users: description: |- The Kubernetes secret which contains the username-password pairs in