Skip to content

Commit 375405f

Browse files
committed
Revert unintentional changes to DatabricksConfig.java
fix
1 parent 7ca3b06 commit 375405f

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -798,18 +798,15 @@ private OpenIDConnectEndpoints fetchDefaultOidcEndpoints() throws IOException {
798798
}
799799

800800
if (isAzure() && getAzureClientId() != null) {
801-
ApiClient apiClient =
802-
new ApiClient.Builder()
803-
.withHttpClient(getHttpClient())
804-
.withGetHostFunc(v -> getHost())
805-
.build();
806-
try {
807-
return apiClient.execute(
808-
new Request("GET", "/oidc/.well-known/oauth-authorization-server"),
809-
OpenIDConnectEndpoints.class);
810-
} catch (IOException e) {
811-
throw new DatabricksException("IO error: " + e.getMessage(), e);
801+
Request request = new Request("GET", getHost() + "/oidc/oauth2/v2.0/authorize");
802+
request.setRedirectionBehavior(false);
803+
Response resp = getHttpClient().execute(request);
804+
String realAuthUrl = resp.getFirstHeader("location");
805+
if (realAuthUrl == null) {
806+
return null;
812807
}
808+
return new OpenIDConnectEndpoints(
809+
realAuthUrl.replaceAll("/authorize", "/token"), realAuthUrl);
813810
}
814811
if (isAccountClient() && getAccountId() != null) {
815812
String prefix = getHost() + "/oidc/accounts/" + getAccountId();

0 commit comments

Comments
 (0)