1
0
mirror of https://github.com/rancher/steve.git synced 2025-06-22 04:57:41 +00:00

Allow service account auth to work with Transport/WrapTransport set

This commit is contained in:
Darren Shepherd 2020-09-09 12:00:04 -07:00
parent 1b98deb6c9
commit e81a4e2c6e

View File

@ -33,8 +33,7 @@ func ImpersonatingHandler(prefix string, cfg *rest.Config) http.Handler {
func setupUserAuth(req *http.Request, user user.Info, cfg *rest.Config) *rest.Config {
for _, group := range user.GetGroups() {
if group == "system:unauthenticated" && strings.HasPrefix(req.Header.Get("Authorization"), "Bearer ") &&
cfg.Transport == nil && cfg.WrapTransport == nil {
if group == "system:unauthenticated" && strings.HasPrefix(req.Header.Get("Authorization"), "Bearer ") {
cfg := rest.CopyConfig(cfg)
cfg.Username = ""
cfg.Password = ""