Skip to content

Commit ebd14da

Browse files
committed
Address comments
1 parent e08cfb7 commit ebd14da

File tree

2 files changed

+1
-46
lines changed

2 files changed

+1
-46
lines changed

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

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@
1717
import java.time.Duration;
1818
import java.util.*;
1919
import org.apache.http.HttpMessage;
20-
import org.slf4j.Logger;
21-
import org.slf4j.LoggerFactory;
2220

2321
public class DatabricksConfig {
24-
private static final Logger LOG = LoggerFactory.getLogger(DatabricksConfig.class);
2522
private CredentialsProvider credentialsProvider = new DefaultCredentialsProvider();
2623

2724
@ConfigAttribute(env = "DATABRICKS_HOST")
@@ -654,19 +651,7 @@ public OpenIDConnectEndpoints getOidcEndpoints() throws IOException {
654651
if (discoveryUrl == null) {
655652
return fetchDefaultOidcEndpoints();
656653
}
657-
try {
658-
OpenIDConnectEndpoints oidcEndpoints = fetchOidcEndpointsFromDiscovery();
659-
if (oidcEndpoints != null) {
660-
return oidcEndpoints;
661-
}
662-
} catch (Exception e) {
663-
LOG.warn(
664-
"Failed to fetch OIDC Endpoints using discovery URL: {}. Error: {}. \nDefaulting to fetch OIDC using default endpoint.",
665-
discoveryUrl,
666-
e.getMessage(),
667-
e);
668-
}
669-
return fetchDefaultOidcEndpoints();
654+
return fetchOidcEndpointsFromDiscovery();
670655
}
671656

672657
private OpenIDConnectEndpoints fetchOidcEndpointsFromDiscovery() {
@@ -756,7 +741,6 @@ public DatabricksEnvironment getDatabricksEnvironment() {
756741
}
757742

758743
private DatabricksConfig clone(Set<String> fieldsToSkip) {
759-
fieldsToSkip.add("LOG");
760744
DatabricksConfig newConfig = new DatabricksConfig();
761745
for (Field f : DatabricksConfig.class.getDeclaredFields()) {
762746
if (fieldsToSkip.contains(f.getName())) {

databricks-sdk-java/src/test/java/com/databricks/sdk/core/DatabricksConfigTest.java

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -166,35 +166,6 @@ public void testDiscoveryEndpoint() throws IOException {
166166
}
167167
}
168168

169-
@Test
170-
public void testDiscoveryEndpointFetchFallback() throws IOException {
171-
String discoveryUrlSuffix = "/test.discovery.url";
172-
String OIDCResponse =
173-
"{\n"
174-
+ " \"authorization_endpoint\": \"https://test.auth.endpoint/oidc/v1/authorize\",\n"
175-
+ " \"token_endpoint\": \"https://test.auth.endpoint/oidc/v1/token\"\n"
176-
+ "}";
177-
178-
try (FixtureServer server =
179-
new FixtureServer()
180-
.with("GET", discoveryUrlSuffix, "", 400)
181-
.with("GET", "/oidc/.well-known/oauth-authorization-server", OIDCResponse, 200)) {
182-
183-
String discoveryUrl = server.getUrl() + discoveryUrlSuffix;
184-
185-
OpenIDConnectEndpoints oidcEndpoints =
186-
new DatabricksConfig()
187-
.setHost(server.getUrl())
188-
.setDiscoveryUrl(discoveryUrl)
189-
.setHttpClient(new CommonsHttpClient.Builder().withTimeoutSeconds(30).build())
190-
.getOidcEndpoints();
191-
192-
assertEquals(
193-
"https://test.auth.endpoint/oidc/v1/authorize", oidcEndpoints.getAuthorizationEndpoint());
194-
assertEquals("https://test.auth.endpoint/oidc/v1/token", oidcEndpoints.getTokenEndpoint());
195-
}
196-
}
197-
198169
@Test
199170
public void testNewWithWorkspaceHost() {
200171
DatabricksConfig config =

0 commit comments

Comments
 (0)