@@ -30,19 +30,26 @@ import (
3030 userinfo "k8s.io/apiserver/pkg/authentication/user"
3131)
3232
33- // SetAuthHeaders stamps the given authenticated user's identity onto the request
34- // headers, after deleting any inbound copies of the identity headers.
35- //
36- // This mirrors k8s.io/client-go/transport.SetAuthProxyHeaders and the upstream
37- // requestheader authenticator's ClearAuthenticationHeaders.
38- func SetAuthHeaders (header http.Header , user userinfo.Info , userHeader , groupHeader , extraHeaderPrefix string ) {
33+ // ClearAuthHeaders deletes any inbound copies of the request-header identity
34+ // headers.
35+ func ClearAuthHeaders (header http.Header , userHeader , groupHeader , extraHeaderPrefix string ) {
3936 header .Del (userHeader )
4037 header .Del (groupHeader )
38+ lowerPrefix := strings .ToLower (extraHeaderPrefix )
4139 for key := range header {
42- if strings .HasPrefix (strings .ToLower (key ), strings . ToLower ( extraHeaderPrefix ) ) {
40+ if strings .HasPrefix (strings .ToLower (key ), lowerPrefix ) {
4341 header .Del (key )
4442 }
4543 }
44+ }
45+
46+ // SetAuthHeaders stamps the given authenticated user's identity onto the request
47+ // headers, after deleting any inbound copies of the identity headers.
48+ //
49+ // This mirrors k8s.io/client-go/transport.SetAuthProxyHeaders and the upstream
50+ // requestheader authenticator's ClearAuthenticationHeaders.
51+ func SetAuthHeaders (header http.Header , user userinfo.Info , userHeader , groupHeader , extraHeaderPrefix string ) {
52+ ClearAuthHeaders (header , userHeader , groupHeader , extraHeaderPrefix )
4653
4754 header .Set (userHeader , user .GetName ())
4855
0 commit comments