3434import nl .altindag .ssl .pem .util .PemUtils ;
3535import okhttp3 .OkHttpClient ;
3636import okhttp3 .Protocol ;
37- import okhttp3 .internal .platform .Platform ;
3837import org .slf4j .Logger ;
3938import org .slf4j .LoggerFactory ;
4039
4140import javax .annotation .Nonnull ;
4241import javax .net .ssl .TrustManager ;
43- import javax .net .ssl .TrustManagerFactory ;
4442import javax .net .ssl .X509ExtendedTrustManager ;
4543import java .io .File ;
4644import java .io .FileInputStream ;
5553import java .util .Collections ;
5654import java .util .List ;
5755import java .util .UUID ;
58- import java .util .function .Function ;
59-
60- import static io .opentdf .platform .sdk .TDF .logger ;
6156
6257/**
6358 * A builder class for creating instances of the SDK class.
@@ -214,7 +209,7 @@ private Interceptor getAuthInterceptor(RSAKey rsaKey) {
214209 // well known endpoint
215210 ProtocolClient bootstrapClient = null ;
216211 GetWellKnownConfigurationResponse config ;
217- bootstrapClient = getProtocolClient (platformEndpoint ) ;
212+ bootstrapClient = getUnauthenticatedProtocolClient (platformEndpoint ) ;
218213 var stub = new WellKnownServiceClient (bootstrapClient );
219214 try {
220215 config = ResponseMessageKt .getOrThrow (stub .getWellKnownConfigurationBlocking (GetWellKnownConfigurationRequest .getDefaultInstance (), Collections .emptyMap ()).execute ());
@@ -282,7 +277,7 @@ ServicesAndInternals buildServices() {
282277 this .platformEndpoint = normalizeAddress (this .platformEndpoint , this .usePlainText );
283278 var authInterceptor = getAuthInterceptor (dpopKey );
284279 var kasClient = getKASClient (dpopKey , authInterceptor );
285- var protocolClient = getProtocolClient (platformEndpoint , authInterceptor );
280+ var protocolClient = getUnauthenticatedProtocolClient (platformEndpoint , authInterceptor );
286281
287282 return new ServicesAndInternals (
288283 authInterceptor ,
@@ -292,19 +287,19 @@ ServicesAndInternals buildServices() {
292287
293288 @ Nonnull
294289 private KASClient getKASClient (RSAKey dpopKey , Interceptor interceptor ) {
295- return new KASClient ((String endpoint ) -> new AccessServiceClient (getProtocolClient (endpoint , interceptor )), dpopKey , usePlainText );
290+ return new KASClient ((String endpoint ) -> new AccessServiceClient (getUnauthenticatedProtocolClient (endpoint , interceptor )), dpopKey , usePlainText );
296291 }
297292
298293 public SDK build () {
299294 var services = buildServices ();
300295 return new SDK (services .services , services .trustManager , services .interceptor );
301296 }
302297
303- private ProtocolClient getProtocolClient (String endpoint ) {
304- return getProtocolClient (endpoint , null );
298+ private ProtocolClient getUnauthenticatedProtocolClient (String endpoint ) {
299+ return getUnauthenticatedProtocolClient (endpoint , null );
305300 }
306301
307- private ProtocolClient getProtocolClient (String endpoint , Interceptor interceptor ) {
302+ private ProtocolClient getUnauthenticatedProtocolClient (String endpoint , Interceptor authInterceptor ) {
308303 var httpClient = new OkHttpClient .Builder ();
309304 if (usePlainText ) {
310305 httpClient .protocols (List .of (Protocol .H2_PRIOR_KNOWLEDGE ));
@@ -321,7 +316,7 @@ private ProtocolClient getProtocolClient(String endpoint, Interceptor intercepto
321316 NetworkProtocol .GRPC ,
322317 null ,
323318 GETConfiguration .Enabled .INSTANCE ,
324- interceptor == null ? Collections .emptyList () : List .of ((_config ) -> interceptor )
319+ authInterceptor == null ? Collections .emptyList () : List .of ((_config ) -> authInterceptor )
325320 );
326321
327322 return new ProtocolClient (new ConnectOkHttpClient (httpClient .build ()), protocolClientConfig );
0 commit comments