Browse Source

stackdriver: wip - always use gce default account for stackdriver

Erik Sundell 7 years ago
parent
commit
b2de0d8c3e
1 changed files with 9 additions and 9 deletions
  1. 9 9
      pkg/api/pluginproxy/ds_auth_provider.go

+ 9 - 9
pkg/api/pluginproxy/ds_auth_provider.go

@@ -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 token, err := tokenProvider.getJwtAccessToken(ctx, data); err != nil {
-			logger.Error("Failed to get access token", "error", err)
-		} else {
-			req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token))
-		}
-	}
-
-	if req.Header.Get("Authorization") == "" && ds.Type == "stackdriver" {
+	// if route.JwtTokenAuth != nil && len(ds.SecureJsonData["privateKey"]) != 0 {
+	// 	if token, err := tokenProvider.getJwtAccessToken(ctx, data); err != nil {
+	// 		logger.Error("Failed to get access token", "error", err)
+	// 	} else {
+	// 		req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token))
+	// 	}
+	// }
+
+	if ds.Type == "stackdriver" {
 		defaultCredentials, err := google.FindDefaultCredentials(ctx, "https://www.googleapis.com/auth/monitoring.read")
 		projectName := ds.JsonData.Get("defaultProject").MustString()
 		if projectName == "" {