Skip to content

Commit

Permalink
use IDEAManager in intellij-common (redhat-developer#718)
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Dietisheim <[email protected]>
  • Loading branch information
adietish committed Mar 22, 2024
1 parent 3be1afb commit 7c19f78
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 437 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
package com.redhat.devtools.intellij.kubernetes.model.client

import com.redhat.devtools.intellij.common.kubernetes.ClusterHelper
import com.redhat.devtools.intellij.kubernetes.model.client.ssl.IDEATrustManager
import com.redhat.devtools.intellij.common.ssl.IDEATrustManager
import io.fabric8.kubernetes.client.Client
import io.fabric8.kubernetes.client.Config
import io.fabric8.kubernetes.client.KubernetesClient
Expand Down Expand Up @@ -59,7 +59,7 @@ abstract class ClientAdapter<C : KubernetesClient>(private val fabric8Client: C)
fun create(
namespace: String? = null,
context: String? = null,
trustManagerProvider: ((toIntegrate: Array<out X509ExtendedTrustManager>) -> X509TrustManager)
trustManagerProvider: ((toIntegrate: List<X509ExtendedTrustManager>) -> X509TrustManager)
= IDEATrustManager()::configure
): ClientAdapter<out KubernetesClient> {
val config = Config.autoConfigure(context)
Expand All @@ -69,7 +69,7 @@ abstract class ClientAdapter<C : KubernetesClient>(private val fabric8Client: C)
fun create(
namespace: String? = null,
config: Config,
externalTrustManagerProvider: (toIntegrate: Array<out X509ExtendedTrustManager>) -> X509TrustManager
externalTrustManagerProvider: (toIntegrate: List<X509ExtendedTrustManager>) -> X509TrustManager
= IDEATrustManager()::configure
): ClientAdapter<out KubernetesClient> {
setNamespace(namespace, config)
Expand All @@ -90,11 +90,10 @@ abstract class ClientAdapter<C : KubernetesClient>(private val fabric8Client: C)
private fun setSslContext(
builder: HttpClient.Builder,
config: Config,
externalTrustManagerProvider: (toIntegrate: Array<out X509ExtendedTrustManager>) -> X509TrustManager
externalTrustManagerProvider: (toIntegrate: List<X509ExtendedTrustManager>) -> X509TrustManager
) {
val clientTrustManagers = SSLUtils.trustManagers(config)
.filterIsInstance<X509ExtendedTrustManager>()
.toTypedArray()
val externalTrustManager = externalTrustManagerProvider.invoke(clientTrustManagers)
builder.sslContext(SSLUtils.keyManagers(config), arrayOf(externalTrustManager))
}
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 7c19f78

Please sign in to comment.