@@ -20,24 +20,41 @@ Configure Transport Layer Security (TLS)
2020Overview
2121--------
2222
23- In this guide, you can learn how to use the Transport Layer Security (TLS)
24- protocol to secure your connection to a MongoDB deployment.
23+ In this guide, you can learn how to use the **TLS protocol** to secure your
24+ connection to a MongoDB deployment. TLS is a cryptographic protocol that
25+ secures communication between your application and MongoDB. To configure
26+ your connection to use TLS, enable the TLS option and provide your
27+ certificates for validation when creating a client.
2528
26- When you enable TLS for a connection, the {+driver-short+} performs the following actions:
29+ .. note::
30+
31+ This page assumes prior knowledge of TLS/SSL and access to valid certificates.
32+ A full description of TLS/SSL, PKI (Public Key Infrastructure) certificates, and
33+ Certificate Authorities (CAs) is beyond the scope of this documentation. To
34+ learn more about TLS, see the Wikipedia entry for :wikipedia:`Transport Layer Security <Transport_Layer_Security>`.
35+
36+ When you enable TLS for a connection, the {+driver-short+} performs the
37+ following actions:
2738
2839- Uses TLS to connect to the MongoDB deployment
2940- Verifies the deployment's certificate
3041
3142To learn how to configure your MongoDB deployment for TLS, see the
3243:manual:`TLS configuration guide </tutorial/configure-ssl/>` in the
33- {+mdb-server+} manual.
44+ {+mdb-server+} manual.
3445
35- .. note::
46+ By default, the driver supports TLS/SSL connections to MongoDB
47+ servers using the underlying support for TLS/SSL provided by the JDK.
48+ This can be changed either by using the `Netty API
49+ <https://netty.io/4.1/api/>`__ or the extensibility of the `Java SE
50+ API <https://docs.oracle.com/javase/8/docs/api/>`__.
3651
37- This page assumes prior knowledge of TLS/SSL and access to valid certificates.
38- A full description of TLS/SSL, PKI (Public Key Infrastructure) certificates, and
39- Certificate Authorities (CAs) is beyond the scope of this documentation. To
40- learn more about TLS, see the Wikipedia entry for :wikipedia:`Transport Layer Security <Transport_Layer_Security>`.
52+ .. tip:: Prefer Netty for Asynchronous Apps
53+
54+ We recommend using Netty for asychronous applications because it supports
55+ asynchronous I/O and handles high connection volumes effectively. To
56+ learn about using Netty to configure your TLS settings, see the
57+ :ref:`scala-tls-netty-sslContext` section of this guide.
4158
4259.. _scala-enable-tls:
4360
@@ -229,6 +246,39 @@ To restrict your application to use only the TLS 1.2 protocol, set the
229246 the TLS 1.2 protocol, upgrade to a later release to use
230247 TLS 1.2.
231248
249+ .. _scala-tls-netty-sslContext:
250+
251+ Configure TLS/SSL by Using Netty SslContext
252+ -------------------------------------------
253+
254+ Include the following import statements:
255+
256+ .. code-block:: kotlin
257+ :copyable: true
258+
259+ import io.netty.handler.ssl.SslContextBuilder
260+ import io.netty.handler.ssl.SslProvider
261+ import org.mongodb.scala.connection.TransportSettings
262+
263+ .. note:: Netty Package Version
264+
265+ The driver tests with Netty package version ``{+netty-version+}``
266+
267+ To instruct the driver to use
268+ `io.netty.handler.ssl.SslContext <https://netty.io/4.1/api/io/netty/handler/ssl/SslContext.html>`__,
269+ configure `NettyTransportSettings <{+core-api+}/connection/NettyTransportSettings.html>`__
270+ when you define your ``MongoClientSettings``.
271+
272+ Use ``MongoClientSettings.Builder.transportSettings()``
273+ and ``NettyTransportSettings.Builder.sslContext()`` to build your settings:
274+
275+ .. literalinclude:: /includes/connect/tls.scala
276+ :start-after: start-netty-ssl-context
277+ :end-before: end-netty-ssl-context
278+ :language: scala
279+ :copyable:
280+ :dedent:
281+
232282.. _scala-tls-custom-sslContext:
233283
234284Customize Configuration with SSLContext
@@ -340,4 +390,4 @@ For more information about any of the types discussed in this guide,
340390see the following API documentation:
341391
342392- `ConnectionString <{+core-api+}/ConnectionString.html>`__
343- - `MongoClientSettings <{+core-api+}/MongoClientSettings.html>`__
393+ - `MongoClientSettings <{+core-api+}/MongoClientSettings.html>`__
0 commit comments