Clear front proxy headers after authentication is complete

This matches the logic we have for the Authorization header as well
as the impersonation headers.

Signed-off-by: Monis Khan <mok@microsoft.com>
This commit is contained in:
Monis Khan
2023-03-20 13:11:38 -04:00
parent 15894cfc85
commit e9866d2794
11 changed files with 335 additions and 22 deletions

View File

@@ -237,6 +237,10 @@ func (o *BuiltInAuthenticationOptions) Validate() []error {
}
}
if o.RequestHeader != nil {
allErrors = append(allErrors, o.RequestHeader.Validate()...)
}
return allErrors
}
@@ -472,6 +476,7 @@ func (o *BuiltInAuthenticationOptions) ApplyTo(authInfo *genericapiserver.Authen
}
}
authInfo.RequestHeaderConfig = authenticatorConfig.RequestHeaderConfig
authInfo.APIAudiences = o.APIAudiences
if o.ServiceAccounts != nil && len(o.ServiceAccounts.Issuers) != 0 && len(o.APIAudiences) == 0 {
authInfo.APIAudiences = authenticator.Audiences(o.ServiceAccounts.Issuers)