Skip to content

Commit c5a174e

Browse files
committed
Honor discovery URL for other flows too
1 parent eed5737 commit c5a174e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ public OpenIDConnectEndpoints getOidcEndpoints() throws IOException {
554554
return oidcEndpoints;
555555
}
556556
} catch (Exception e) {
557-
LOG.debug(
557+
LOG.warn(
558558
"Failed to fetch OIDC Endpoints using discovery URL: {}. Error: {}. \nDefaulting to fetch OIDC using default endpoint.",
559559
discoveryUrl,
560560
e.getMessage(),

databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/OAuthClient.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class OAuthClient {
3131
public static class Builder {
3232
private String host;
3333
private String clientId;
34+
private String discoveryUrl;
3435
private String redirectUrl;
3536
private List<String> scopes;
3637
private String clientSecret;
@@ -53,6 +54,11 @@ public Builder withClientId(String clientId) {
5354
return this;
5455
}
5556

57+
public Builder withDiscoveryUrl(String discoveryUrl) {
58+
this.discoveryUrl = discoveryUrl;
59+
return this;
60+
}
61+
5662
public Builder withClientSecret(String clientSecret) {
5763
this.clientSecret = clientSecret;
5864
return this;
@@ -91,6 +97,7 @@ public OAuthClient(DatabricksConfig config) throws IOException {
9197
.withHttpClient(config.getHttpClient())
9298
.withClientId(config.getClientId())
9399
.withClientSecret(config.getClientSecret())
100+
.withDiscoveryUrl(config.getDiscoveryUrl())
94101
.withHost(config.getHost())
95102
.withRedirectUrl(
96103
config.getOAuthRedirectUrl() != null
@@ -106,7 +113,7 @@ private OAuthClient(Builder b) throws IOException {
106113
this.host = b.host;
107114
this.hc = b.hc;
108115

109-
DatabricksConfig config = new DatabricksConfig().setHost(b.host).resolve();
116+
DatabricksConfig config = new DatabricksConfig().setHost(b.host).setDiscoveryUrl(b.discoveryUrl).resolve();
110117
OpenIDConnectEndpoints oidc = config.getOidcEndpoints();
111118
if (oidc == null) {
112119
throw new DatabricksException(b.host + " does not support OAuth");

0 commit comments

Comments
 (0)