Skip to content

Commit d5331fb

Browse files
committed
test
1 parent 4b17291 commit d5331fb

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

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

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

800800
if (isAzure() && getAzureClientId() != null) {
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;
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);
807812
}
808-
return new OpenIDConnectEndpoints(
809-
realAuthUrl.replaceAll("/authorize", "/token"), realAuthUrl);
810813
}
811814
if (isAccountClient() && getAccountId() != null) {
812815
String prefix = getHost() + "/oidc/accounts/" + getAccountId();

0 commit comments

Comments
 (0)