// WithImpersonation is a filter that will inspect and check requests that attempt to change the user.Info for their requests func WithImpersonation(handler http.Handler, a authorizer.Authorizer, s runtime.NegotiatedSerializer) http.Handler { … } func userString(u user.Info) string { … } func unescapeExtraKey(encodedKey string) string { … } // buildImpersonationRequests returns a list of objectreferences that represent the different things we're requesting to impersonate. // Also includes a map[string][]string representing user.Info.Extra // Each request must be authorized against the current user before switching contexts. func buildImpersonationRequests(headers http.Header) ([]v1.ObjectReference, error) { … }