Skip to content

Commit

Permalink
Turn hostname verification off when disabling SSL certificate validation
Browse files Browse the repository at this point in the history
  • Loading branch information
VonDerBeck committed Apr 30, 2019
1 parent 49f7d44 commit 1d71ad1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Features:
* Broad support for user and group queries
* Compatible with Spring Boot OAuth2 SSO

Current version: `0.6.0-SNAPSHOT`<br >
Current version: `0.6.1-SNAPSHOT`<br >
Tested with: Keycloak `4.8.3.Final`, Camunda `7.10.0` and Camunda `7.10.3-ee`

Known limitations:
Expand Down Expand Up @@ -51,7 +51,7 @@ Maven Dependencies:
<dependency>
<groupId>de.vonderbeck.bpm.identity</groupId>
<artifactId>camunda-identity-keycloak</artifactId>
<version>0.6.0-SNAPSHOT</version>
<version>0.6.1-SNAPSHOT</version>
</dependency>


Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>de.vonderbeck.bpm.identity</groupId>
<artifactId>camunda-identity-keycloak</artifactId>
<version>0.6.0-SNAPSHOT</version>
<version>0.6.1-SNAPSHOT</version>

<packaging>jar</packaging>
<name>camunda BPM - engine plugins - identity - keycloak</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import java.security.GeneralSecurityException;
import java.security.cert.X509Certificate;

import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;

import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.LaxRedirectStrategy;
Expand Down Expand Up @@ -48,8 +50,9 @@ public KeycloakIdentityProviderFactory(KeycloakConfiguration keycloakConfigurati
SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom()
.loadTrustMaterial(null, acceptingTrustStrategy)
.build();
HostnameVerifier allowAllHosts = new NoopHostnameVerifier();
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder
.<ConnectionSocketFactory> create().register("https", new SSLConnectionSocketFactory(sslContext))
.<ConnectionSocketFactory> create().register("https", new SSLConnectionSocketFactory(sslContext, allowAllHosts))
.build();
final PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
connectionManager.setMaxTotal(keycloakConfiguration.getMaxHttpConnections());
Expand Down

0 comments on commit 1d71ad1

Please sign in to comment.