K8s: add ID token to requests outbound to new query endpoint (#86214)

This commit is contained in:
Charandas 2024-04-15 11:34:20 -07:00 committed by GitHub
parent cc87281d71
commit 2aedd9dacf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,6 +7,7 @@ import (
"net/http"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana/pkg/util/proxyutil"
"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/api/response"
@ -50,6 +51,7 @@ func (hs *HTTPServer) getDSQueryEndpoint() web.Handler {
return
}
r.URL.Path = "/apis/query.grafana.app/v0alpha1/namespaces/" + namespaceMapper(user.OrgID) + "/query"
r.Header.Add(proxyutil.IDHeaderName, user.GetIDToken())
hs.clientConfigProvider.DirectlyServeHTTP(w, r)
}
}