func NewAuthProxyRoundTripper(username string, groups []string, extra map[string][]string, rt http.RoundTripper) http.RoundTripper {
	return &authProxyRoundTripper{
		username: username,
		groups:   groups,
		extra:    extra,
		rt:       rt,
	}
}
NewAuthProxyRoundTripper provides a roundtripper which will add auth proxy fields to requests for
authentication terminating proxy cases
assuming you pull the user from the context:
username is the user.Info.GetName() of the user
groups is the user.Info.GetGroups() of the user
extra is the user.Info.GetExtra() of the user
extra can contain any additional information that the authenticator
thought was interesting, for example authorization scopes.
In order to faithfully round-trip through an impersonation flow, these keys
MUST be lowercase.
package transport
import (
	"fmt"
	"net/http"
	"strings"
	"time"
	"github.com/golang/glog"
	utilnet "k8s.io/apimachinery/pkg/util/net"
)
func HTTPWrappersForConfig(config *Config, rt http.RoundTripper) (http.RoundTripper, error) {
	if config.WrapTransport != nil {
		rt = config.WrapTransport(rt)
	}
	rt = DebugWrappers(rt)
	switch {
	case config.HasBasicAuth() && config.HasTokenAuth():
		return nil, fmt.Errorf("username/password or bearer token may be set, but not both")
	case config.HasTokenAuth():
		rt = NewBearerAuthRoundTripper(config.BearerToken, rt)
	case config.HasBasicAuth():
		rt = NewBasicAuthRoundTripper(config.Username, config.Password, rt)
	}
	if len(config.UserAgent) > 0 {
		rt = NewUserAgentRoundTripper(config.UserAgent, rt)
	}
	if len(config.Impersonate.UserName) > 0 ||
		len(config.Impersonate.Groups) > 0 ||
		len(config.Impersonate.Extra) > 0 {
		rt = NewImpersonatingRoundTripper(config.Impersonate, rt)
	}
	return rt, nil
}
func DebugWrappers(rt http.RoundTripper) http.RoundTripper {
	switch {
	case bool(glog.V(9)):
		rt = newDebuggingRoundTripper(rt, debugCurlCommand, debugURLTiming, debugResponseHeaders)
	case bool(glog.V(8)):
		rt = newDebuggingRoundTripper(rt, debugJustURL, debugRequestHeaders, debugResponseStatus, debugResponseHeaders)
	case bool(glog.V(7)):
		rt = newDebuggingRoundTripper(rt, debugJustURL, debugRequestHeaders, debugResponseStatus)
	case bool(glog.V(6)):
		rt = newDebuggingRoundTripper(rt, debugURLTiming)
	}
	return rt
}
type requestCanceler interface {
	CancelRequest(*http.Request)
}
type authProxyRoundTripper struct {
	username string
	groups   []string
	extra    map[string][]string
	rt http.RoundTripper
}