File tree Expand file tree Collapse file tree 2 files changed +41
-7
lines changed
main/java/com/databricks/sdk/core
test/java/com/databricks/sdk/core Expand file tree Collapse file tree 2 files changed +41
-7
lines changed Original file line number Diff line number Diff line change @@ -410,13 +410,17 @@ public DatabricksConfig setAzureUseMsi(boolean azureUseMsi) {
410
410
return this ;
411
411
}
412
412
413
- /** @deprecated Use {@link #getAzureUseMsi()} instead. */
413
+ /**
414
+ * @deprecated Use {@link #getAzureUseMsi()} instead.
415
+ */
414
416
@ Deprecated ()
415
417
public boolean getAzureUseMSI () {
416
418
return azureUseMsi ;
417
419
}
418
420
419
- /** @deprecated Use {@link #setAzureUseMsi(boolean)} instead. */
421
+ /**
422
+ * @deprecated Use {@link #setAzureUseMsi(boolean)} instead.
423
+ */
420
424
@ Deprecated
421
425
public DatabricksConfig setAzureUseMSI (boolean azureUseMsi ) {
422
426
this .azureUseMsi = azureUseMsi ;
@@ -745,12 +749,11 @@ public String getEffectiveOAuthRedirectUrl() {
745
749
}
746
750
747
751
/**
748
- * Determines if Azure-specific OIDC endpoints should be used.
749
- * This is true in two cases:
750
- * 1. When auth type is not specified (this is only in case of external browser auth)
751
- * 2. When Azure client ID is present (service principal auth)
752
+ * Determines if Azure-specific OIDC endpoints should be used. This is true in two cases: 1. When
753
+ * auth type is not specified (this is only in case of external browser auth) 2. When Azure client
754
+ * ID is present (service principal auth)
752
755
*/
753
- private boolean shouldUseAzureOidcEndpoints () {
756
+ boolean shouldUseAzureOidcEndpoints () {
754
757
return Objects .equals (getAuthType (), null ) || getAzureClientId () != null ;
755
758
}
756
759
}
Original file line number Diff line number Diff line change @@ -251,4 +251,35 @@ public void testGetTokenSourceWithOAuth() {
251
251
assertFalse (tokenSource instanceof ErrorTokenSource );
252
252
assertEquals (tokenSource .getToken ().getAccessToken (), "test-token" );
253
253
}
254
+
255
+ @ Test
256
+ public void testShouldUseAzureOidcEndpointsForExternalBrowserAuth () {
257
+ DatabricksConfig config =
258
+ new DatabricksConfig ()
259
+ .setHost ("https://adb-1234567890.0.azuredatabricks.net/" )
260
+ .setAuthType (null );
261
+ assertTrue (config .shouldUseAzureOidcEndpoints ());
262
+ }
263
+
264
+ @ Test
265
+ public void testShouldUseAzureOidcEndpointsForServicePrincipal () {
266
+ DatabricksConfig config =
267
+ new DatabricksConfig ()
268
+ .setHost ("https://adb-1234567890.0.azuredatabricks.net/" )
269
+ .setAzureClientId ("test-client-id" )
270
+ .setAzureClientSecret ("test-client-secret" )
271
+ .setAzureTenantId ("test-tenant-id" );
272
+ assertTrue (config .shouldUseAzureOidcEndpoints ());
273
+ }
274
+
275
+ @ Test
276
+ public void testShouldNotUseAzureOidcEndpointsForAzureM2M () {
277
+ DatabricksConfig config =
278
+ new DatabricksConfig ()
279
+ .setHost ("https://adb-1234567890.0.azuredatabricks.net/" )
280
+ .setAuthType ("oauth-m2m" )
281
+ .setClientId ("test-client-id" )
282
+ .setClientSecret ("test-client-secret" );
283
+ assertFalse (config .shouldUseAzureOidcEndpoints ());
284
+ }
254
285
}
You can’t perform that action at this time.
0 commit comments