Skip to content

Commit

Permalink
KCBC-156 FIT: Add support for CLUSTER_CONFIG_INSECURE
Browse files Browse the repository at this point in the history
Change-Id: Ie1f9a096c712db24a4b80357d9e2c68b0fa6e5f5
Reviewed-on: https://review.couchbase.org/c/couchbase-jvm-clients/+/206666
Reviewed-by: David Nault <david.nault@couchbase.com>
Tested-by: David Nault <david.nault@couchbase.com>
  • Loading branch information
dnault committed Mar 4, 2024
1 parent c871e08 commit 465f443
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Expand Up @@ -58,6 +58,7 @@ class KotlinPerformer : CorePerformer() {
.addSdkImplementationCaps(Caps.SDK_SEARCH_INDEX_MANAGEMENT)
.addSdkImplementationCaps(Caps.SDK_SCOPE_SEARCH_INDEX_MANAGEMENT)
.addPerformerCaps(PerformerCaps.CLUSTER_CONFIG_CERT)
.addPerformerCaps(PerformerCaps.CLUSTER_CONFIG_INSECURE)
}

override fun clusterConnectionCreate(
Expand Down
Expand Up @@ -16,6 +16,7 @@

package com.couchbase.client.performer.kotlin.util

import com.couchbase.client.core.deps.io.netty.handler.ssl.util.InsecureTrustManagerFactory
import com.couchbase.client.core.env.SecurityConfig
import com.couchbase.client.kotlin.Cluster
import com.couchbase.client.kotlin.Collection
Expand Down Expand Up @@ -76,6 +77,7 @@ class ClusterConnection(req: ClusterConnectionCreateRequest) {

private val ClusterConfig.trustSource: TrustSource
get() = when {
hasInsecure() && insecure -> TrustSource.factory(InsecureTrustManagerFactory.INSTANCE)
hasCertPath() -> TrustSource.certificate(Path(certPath))
hasCert() -> TrustSource.certificates(SecurityConfig.decodeCertificates(listOf(cert)))
else -> TrustSource.certificates(SecurityConfig.defaultCaCertificates())
Expand Down

0 comments on commit 465f443

Please sign in to comment.