Commit b2de0d8c by Erik Sundell

stackdriver: wip - always use gce default account for stackdriver

parent 20021620
...@@ -55,15 +55,15 @@ func ApplyRoute(ctx context.Context, req *http.Request, proxyPath string, route ...@@ -55,15 +55,15 @@ func ApplyRoute(ctx context.Context, req *http.Request, proxyPath string, route
} }
} }
if route.JwtTokenAuth != nil && len(ds.SecureJsonData["privateKey"]) != 0 { // if route.JwtTokenAuth != nil && len(ds.SecureJsonData["privateKey"]) != 0 {
if token, err := tokenProvider.getJwtAccessToken(ctx, data); err != nil { // if token, err := tokenProvider.getJwtAccessToken(ctx, data); err != nil {
logger.Error("Failed to get access token", "error", err) // logger.Error("Failed to get access token", "error", err)
} else { // } else {
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token)) // req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token))
} // }
} // }
if req.Header.Get("Authorization") == "" && ds.Type == "stackdriver" { if ds.Type == "stackdriver" {
defaultCredentials, err := google.FindDefaultCredentials(ctx, "https://www.googleapis.com/auth/monitoring.read") defaultCredentials, err := google.FindDefaultCredentials(ctx, "https://www.googleapis.com/auth/monitoring.read")
projectName := ds.JsonData.Get("defaultProject").MustString() projectName := ds.JsonData.Get("defaultProject").MustString()
if projectName == "" { if projectName == "" {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment