Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/connection/auth/DatabricksOAuth/OAuthManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ export default abstract class OAuthManager {
return new DatabricksOAuthManager(options);
}

const gcpDomains = ['.gcp.databricks.com'];
const isGCPDomain = gcpDomains.some((domain) => host.endsWith(domain));
if (isGCPDomain) {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
return new DatabricksOAuthManager(options);
}

if (options.useDatabricksOAuthInAzure) {
const domains = ['.azuredatabricks.net'];
const isSupportedDomain = domains.some((domain) => host.endsWith(domain));
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/DBSQLClient.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,19 @@ describe('DBSQLClient.initAuthProvider', () => {
expect(provider.manager).to.be.instanceOf(AzureOAuthManager);
});

it('should use Databricks OAuth method (GCP)', () => {
const client = new DBSQLClient();

const provider = client.initAuthProvider({
authType: 'databricks-oauth',
// host is used when creating OAuth manager, so make it look like a real AWS instance
host: 'example.gcp.databricks.com',
});

expect(provider).to.be.instanceOf(DatabricksOAuth);
expect(provider.manager).to.be.instanceOf(DatabricksOAuthManager);
});

it('should use Databricks InHouse OAuth method (Azure)', () => {
const client = new DBSQLClient();

Expand Down