Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions sdk/src/main/java/io/opentdf/platform/sdk/SDKBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public SDKBuilder protocol(ProtocolType protocolType) {
return this;
}

private Interceptor getAuthInterceptor(RSAKey rsaKey) {
private Interceptor getAuthInterceptor(RSAKey rsaKey, OkHttpClient httpClient) {
if (platformEndpoint == null) {
throw new SDKException("cannot build an SDK without specifying the platform endpoint");
}
Expand All @@ -191,7 +191,6 @@ private Interceptor getAuthInterceptor(RSAKey rsaKey) {
// we don't add the auth listener to this channel since it is only used to call
// the well known endpoint
GetWellKnownConfigurationResponse config;
var httpClient = getHttpClient();
ProtocolClient bootstrapClient = getUnauthenticatedProtocolClient(platformEndpoint, httpClient) ;
var stub = new WellKnownServiceClient(bootstrapClient);
try {
Expand Down Expand Up @@ -266,9 +265,9 @@ ServicesAndInternals buildServices() {
}

this.platformEndpoint = AddressNormalizer.normalizeAddress(this.platformEndpoint, this.usePlainText);
var authInterceptor = getAuthInterceptor(dpopKey);
var kasClient = getKASClient(dpopKey, authInterceptor);
var httpClient = getHttpClient();
var authInterceptor = getAuthInterceptor(dpopKey, httpClient);
var kasClient = getKASClient(dpopKey, authInterceptor, httpClient);
var client = getProtocolClient(platformEndpoint, httpClient, authInterceptor);
var attributeService = new AttributesServiceClient(client);
var namespaceService = new NamespaceServiceClient(client);
Expand Down Expand Up @@ -341,9 +340,9 @@ public SDK.KAS kas() {
}

@Nonnull
private KASClient getKASClient(RSAKey dpopKey, Interceptor interceptor) {
private KASClient getKASClient(RSAKey dpopKey, Interceptor interceptor, OkHttpClient httpClient) {
BiFunction<OkHttpClient, String, ProtocolClient> protocolClientFactory = (OkHttpClient client, String address) -> getProtocolClient(address, client, interceptor);
return new KASClient(getHttpClient(), protocolClientFactory, dpopKey, usePlainText);
return new KASClient(httpClient, protocolClientFactory, dpopKey, usePlainText);
}

public SDK build() {
Expand Down
Loading