Anyone knows if there is still a way to set ssl context programmatically for 2.4.0?
Hi Dima,
Could you clarify what do you mean by setting ssl context programmatically ?
Do you mean using MongoClientSettings.Builder ? (since MongoDB Scala driver v2.3.0)
val mongoClient: MongoClient = MongoClient(
MongoClientSettings.builder()
.credential(MongoCredential.createCredential("username", "authdb", ("passsword").toCharArray))
.applyToClusterSettings((builder: ClusterSettings.Builder) => builder.hosts(List(
new ServerAddress("host1", 27017),
new ServerAddress("host2", 27017),
new ServerAddress("host3", 27017),
).asJava))
.streamFactoryFactory(NettyStreamFactoryFactory())
.applyToSslSettings((builder: SslSettings.Builder) => builder.enabled(true).invalidHostNameAllowed(true))
.build()
);
requires usage of -D attributes to set the global trust store and key store.
or perhaps you are referring to the JVM System Properties, i.e. javax.net.ssl.trustStore ?
Could you clarify with an example on what you did in MongoDB Scala driver v2.2.0 that you couldn’t do in v2.4.0 ?
Regards,
Wan.