KEYCLOAK-1155 Added SSL support for MongoDB connections

This commit is contained in:
Dane Barentine 2015-03-25 22:19:32 -07:00
parent 3b15da2fdd
commit b5d5f340ba

View file

@ -14,6 +14,7 @@ import org.keycloak.connections.mongo.updater.MongoUpdaterProvider;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory; import org.keycloak.models.KeycloakSessionFactory;
import javax.net.ssl.SSLSocketFactory;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Collections; import java.util.Collections;
@ -149,6 +150,10 @@ public class DefaultMongoConnectionFactoryProvider implements MongoConnectionPro
if (config.getLong("maxAutoConnectRetryTime") != null) { if (config.getLong("maxAutoConnectRetryTime") != null) {
builder.maxAutoConnectRetryTime(config.getLong("maxAutoConnectRetryTime")); builder.maxAutoConnectRetryTime(config.getLong("maxAutoConnectRetryTime"));
} }
if(config.getBoolean("ssl", false)) {
builder.socketFactory(SSLSocketFactory.getDefault());
}
return builder.build(); return builder.build();
} }