Skip to content

Conversation

@rjrudin
Copy link
Contributor

@rjrudin rjrudin commented Jan 25, 2023

Discovered this while doing some manual testing. The main ML Cloud instance that has been used for testing is not verifying certificates, and thus this line of code for configuring an SSL socket factory was not required. But if certificates are verified (which I ran into while doing some local testing using an emulated ML Cloud instance), we'll presumably want to construct an SSL socket factory using the same SSLContext and TrustManager that the Java Client uses when it constructs a DatabaseClient.

Can only test this via manual testing, until we have a way to run automated tests against an ML Cloud instance.

Discovered this while doing some manual testing. The main ML Cloud instance that has been used for testing is not verifying certificates, and thus this line of code for configuring an SSL socket factory was not required. But if certificates are verified (which I ran into while doing some local testing using an emulated ML Cloud instance), we'll presumably want to construct an SSL socket factory using the same SSLContext and TrustManager that the Java Client uses when it constructs a DatabaseClient. 

Can only test this via manual testing, until we have a way to run automated tests against an ML Cloud instance.
@rjrudin rjrudin requested a review from BillFarber January 25, 2023 17:40
private Response callTokenEndpoint(MarkLogicCloudAuthContext securityContext) {
final HttpUrl tokenUrl = buildTokenUrl(securityContext);
OkHttpClient.Builder clientBuilder = OkHttpUtil.newClientBuilder();
// Initial testing has shown that neither the OkHttp socket factory nor hostname verifier need to be configured
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is likely wrong; it was only due to the "test" cloud instance I was using not doing any certificate verification.

* @param trustManager
*/
private static void configureSocketFactory(OkHttpClient.Builder clientBuilder, SSLContext sslContext, X509TrustManager trustManager) {
static void configureSocketFactory(OkHttpClient.Builder clientBuilder, SSLContext sslContext, X509TrustManager trustManager) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened this up for package-level access so that MarkLogicCloudAuthenticationConfigurer can reuse it. It's also used when constructing the OkHttpClient used for talking to MarkLogic.

@rjrudin rjrudin merged commit bc724e2 into develop Jan 25, 2023
@rjrudin rjrudin deleted the feature/ssl-tweak branch January 25, 2023 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants