mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
clear impersonation headers
This commit is contained in:
parent
c9d0969d25
commit
e69d0d84a4
@ -123,6 +123,15 @@ func WithImpersonation(handler http.Handler, requestContextMapper api.RequestCon
|
|||||||
oldUser, _ := api.UserFrom(ctx)
|
oldUser, _ := api.UserFrom(ctx)
|
||||||
httplog.LogOf(req, w).Addf("%v is acting as %v", oldUser, newUser)
|
httplog.LogOf(req, w).Addf("%v is acting as %v", oldUser, newUser)
|
||||||
|
|
||||||
|
// clear all the impersonation headers from the request
|
||||||
|
req.Header.Del(authenticationapi.ImpersonateUserHeader)
|
||||||
|
req.Header.Del(authenticationapi.ImpersonateGroupHeader)
|
||||||
|
for headerName := range req.Header {
|
||||||
|
if strings.HasPrefix(headerName, authenticationapi.ImpersonateUserExtraHeaderPrefix) {
|
||||||
|
req.Header.Del(headerName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handler.ServeHTTP(w, req)
|
handler.ServeHTTP(w, req)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user