Skip to content

Commit 32f18f9

Browse files
committed
Fix azure u2m
1 parent 78c2a24 commit 32f18f9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

databricks-sdk-java/src/main/java/com/databricks/sdk/core/DatabricksConfig.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,8 @@ private OpenIDConnectEndpoints fetchDefaultOidcEndpoints() throws IOException {
628628
if (getHost() == null) {
629629
return null;
630630
}
631-
if (isAzure() && getAzureClientId() != null) {
631+
632+
if (isAzure() && shouldUseAzureOidcEndpoints()) {
632633
Request request = new Request("GET", getHost() + "/oidc/oauth2/v2.0/authorize");
633634
request.setRedirectionBehavior(false);
634635
Response resp = getHttpClient().execute(request);
@@ -742,4 +743,14 @@ public DatabricksConfig newWithWorkspaceHost(String host) {
742743
public String getEffectiveOAuthRedirectUrl() {
743744
return redirectUrl != null ? redirectUrl : "http://localhost:8080/callback";
744745
}
746+
747+
/**
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+
*/
753+
private boolean shouldUseAzureOidcEndpoints() {
754+
return Objects.equals(getAuthType(), null) || getAzureClientId() != null;
755+
}
745756
}

0 commit comments

Comments
 (0)