From 8c7a08e580b17661364a3729798f03a226e66b9f Mon Sep 17 00:00:00 2001 From: mauritsdebruin <79079263+mauritsdebruin@users.noreply.github.com> Date: Fri, 28 Apr 2023 14:54:24 +0200 Subject: [PATCH] Fix connection-pool-size 0 being ignored and being unable to disable the connection pool --- .../main/java/org/keycloak/adapters/HttpClientBuilder.java | 6 ++---- .../org/keycloak/adapters/cloned/HttpClientBuilder.java | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/HttpClientBuilder.java b/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/HttpClientBuilder.java index aea696055b..7338f220a6 100755 --- a/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/HttpClientBuilder.java +++ b/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/HttpClientBuilder.java @@ -427,13 +427,11 @@ public class HttpClientBuilder { throw new RuntimeException("Failed to load keystore", e); } } - int size = 10; - if (adapterConfig.getConnectionPoolSize() > 0) - size = adapterConfig.getConnectionPoolSize(); + HttpClientBuilder.HostnameVerificationPolicy policy = HttpClientBuilder.HostnameVerificationPolicy.WILDCARD; if (adapterConfig.isAllowAnyHostname()) policy = HttpClientBuilder.HostnameVerificationPolicy.ANY; - connectionPoolSize(size); + connectionPoolSize(adapterConfig.getConnectionPoolSize()); hostnameVerification(policy); if (adapterConfig.isDisableTrustManager()) { disableTrustManager(); diff --git a/adapters/saml/core/src/main/java/org/keycloak/adapters/cloned/HttpClientBuilder.java b/adapters/saml/core/src/main/java/org/keycloak/adapters/cloned/HttpClientBuilder.java index e531024ed2..c3706a62db 100644 --- a/adapters/saml/core/src/main/java/org/keycloak/adapters/cloned/HttpClientBuilder.java +++ b/adapters/saml/core/src/main/java/org/keycloak/adapters/cloned/HttpClientBuilder.java @@ -359,13 +359,11 @@ public class HttpClientBuilder { throw new RuntimeException("Failed to load keystore", e); } } - int size = 10; - if (adapterConfig.getConnectionPoolSize() > 0) - size = adapterConfig.getConnectionPoolSize(); + HttpClientBuilder.HostnameVerificationPolicy policy = HttpClientBuilder.HostnameVerificationPolicy.WILDCARD; if (adapterConfig.isAllowAnyHostname()) policy = HttpClientBuilder.HostnameVerificationPolicy.ANY; - connectionPoolSize(size); + connectionPoolSize(adapterConfig.getConnectionPoolSize()); hostnameVerification(policy); if (adapterConfig.isDisableTrustManager()) { disableTrustManager();