@@ -10,12 +10,12 @@ import (
1010
1111 "github.com/Azure/azure-sdk-for-go/sdk/azcore"
1212 "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
13+ "github.com/databricks/databricks-sdk-go/common/environment"
1314 "github.com/databricks/databricks-sdk-go/config"
15+ "github.com/databricks/databricks-sdk-go/config/credentials"
1416 "github.com/sethvargo/go-githubactions"
1517 "golang.org/x/oauth2"
1618 "golang.org/x/oauth2/clientcredentials"
17- "github.com/databricks/databricks-sdk-go/common/environment"
18- "github.com/databricks/databricks-sdk-go/config/credentials"
1919)
2020
2121func NewWithGitHubOIDC (a * githubactions.Action , vaultURI string ) * vaultEnv {
@@ -64,11 +64,11 @@ func (c *ghOidcCreds) Name() string {
6464}
6565
6666type credentialsProviderFunc struct {
67- setHeadersFunc func (r * http.Request ) error
67+ setHeadersFunc func (r * http.Request ) error
6868}
6969
7070func (cpf * credentialsProviderFunc ) SetHeaders (r * http.Request ) error {
71- return cpf .setHeadersFunc (r )
71+ return cpf .setHeadersFunc (r )
7272}
7373
7474// Configure implements credentials provider for Databricks SDK
@@ -81,8 +81,8 @@ func (c *ghOidcCreds) Configure(ctx context.Context, cfg *config.Config) (creden
8181 setHeadersFunc : func (r * http.Request ) error {
8282 token , err := ts .Token ()
8383 if err != nil {
84- return fmt .Errorf ("token: %w" , err )
85- }
84+ return fmt .Errorf ("token: %w" , err )
85+ }
8686 token .SetAuthHeader (r )
8787 return nil
8888 },
@@ -107,16 +107,16 @@ func (c *ghOidcCreds) GetToken(ctx context.Context, options policy.TokenRequestO
107107}
108108
109109func (c * ghOidcCreds ) SetHeaders (r * http.Request ) error {
110- env := environment .GetEnvironmentForHostname (r .Host )
111- azureManagementURL := env .AzureResourceManagerEndpoint ()
112- token , err := c .GetToken (r .Context (), policy.TokenRequestOptions {
113- Scopes : []string {azureManagementURL + "/.default" },
114- })
115- if err != nil {
116- return fmt .Errorf ("token: %w" , err )
117- }
118- r .Header .Set ("Authorization" , "Bearer " + token .Token )
119- return nil
110+ env := environment .GetEnvironmentForHostname (r .Host )
111+ azureManagementURL := env .AzureResourceManagerEndpoint ()
112+ token , err := c .GetToken (r .Context (), policy.TokenRequestOptions {
113+ Scopes : []string {azureManagementURL + "/.default" },
114+ })
115+ if err != nil {
116+ return fmt .Errorf ("token: %w" , err )
117+ }
118+ r .Header .Set ("Authorization" , "Bearer " + token .Token )
119+ return nil
120120}
121121
122122type msiToken struct {
0 commit comments