Skip to content

Commit

Permalink
work
Browse files Browse the repository at this point in the history
  • Loading branch information
mgyucht committed Jul 11, 2024
1 parent f47c810 commit 3a976f8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions config/auth_databricks_oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ package config

import (
"context"
"net/url"

"github.com/databricks/databricks-sdk-go/credentials"
"github.com/databricks/databricks-sdk-go/logger"
"golang.org/x/oauth2"
"golang.org/x/oauth2/clientcredentials"
)

const jwtBearerGrantTypeURN = "urn:ietf:params:oauth:grant-type:jwt-bearer"

type DatabricksOIDCCredentials struct{}

// Configure implements CredentialsStrategy.
Expand Down Expand Up @@ -38,10 +41,14 @@ func (d DatabricksOIDCCredentials) Configure(ctx context.Context, cfg *Config) (

tsConfig := clientcredentials.Config{
ClientID: cfg.ClientID,
ClientSecret: idToken,
AuthStyle: oauth2.AuthStyleInHeader,
ClientSecret: "",
AuthStyle: oauth2.AuthStyleInParams,
TokenURL: endpoints.TokenEndpoint,
Scopes: []string{"all-apis"},
EndpointParams: url.Values{
"grant_type": {jwtBearerGrantTypeURN},
"assertion": {idToken},
},
}
ts := tsConfig.TokenSource(ctx)
visitor := refreshableVisitor(ts)
Expand Down

0 comments on commit 3a976f8

Please sign in to comment.