Skip to content

Commit bfcc820

Browse files
committed
move x509 up
1 parent a5eb728 commit bfcc820

File tree

1 file changed

+64
-64
lines changed

1 file changed

+64
-64
lines changed

source/security/authentication.txt

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,70 @@ mechanism:
232232
:start-after: start-scramsha1-mongo-cred
233233
:end-before: end-scramsha1-mongo-cred
234234

235+
.. _kotlin-sync-auth-x509:
236+
237+
MONGODB-X509
238+
------------
239+
240+
The ``X.509`` authentication mechanism uses
241+
:wikipedia:`TLS <Transport_Layer_Security>` with X.509 certificates to
242+
authenticate your user, identified by the relative distinguished names
243+
(RDNs) of your client certificate. When you specify the ``X.509``
244+
authentication mechanism, the server authenticates the connection using
245+
the subject name of the client certificate.
246+
247+
The following code snippets show how to specify the authentication mechanism,
248+
using the following placeholders:
249+
250+
* ``hostname`` - network address of your MongoDB server, accessible by your client.
251+
* ``port`` - port number of your MongoDB server.
252+
* ``authenticationDb`` - MongoDB database that contains your user's
253+
authentication data. If you omit this parameter, the driver uses the
254+
default value ``admin``.
255+
256+
Select the :guilabel:`Connection String` or the :guilabel:`MongoCredential`
257+
tab below for instructions and sample code for specifying this authentication
258+
mechanism:
259+
260+
.. tabs::
261+
262+
.. tab::
263+
:tabid: Connection String
264+
265+
To specify the ``X.509`` authentication mechanism using a connection
266+
string, assign the ``authMechanism`` parameter the value ``MONGODB-X509``
267+
and enable TLS by assigning the ``tls``
268+
parameter a ``true`` value. Your code to instantiate a ``MongoClient``
269+
should resemble the following:
270+
271+
.. literalinclude:: /includes/security/authentication.kt
272+
:language: kotlin
273+
:dedent:
274+
:start-after: start-x509-connect-string
275+
:end-before: end-x509-connect-string
276+
277+
.. tab::
278+
:tabid: MongoCredential
279+
280+
To specify the ``X.509`` authentication mechanism using the
281+
``MongoCredential`` class, use the
282+
`createMongoX509Credential() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoCredential.html#createMongoX509Credential(java.lang.String)>`__
283+
method. Also, enable TLS by calling the
284+
`applyToSslSettings() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoClientSettings.Builder.html#applyToSslSettings(com.mongodb.Block)>`__
285+
method and setting the ``enabled`` property to ``true`` in the
286+
`SslSettings.Builder <{+api+}/apidocs/mongodb-driver-core/com/mongodb/connection/SslSettings.Builder.html>`__
287+
block. Your code to instantiate a ``MongoClient`` should resemble the following:
288+
289+
.. literalinclude:: /includes/security/authentication.kt
290+
:language: kotlin
291+
:dedent:
292+
:start-after: start-x509-mcred
293+
:end-before: end-x509-mcred
294+
295+
For additional information on configuring your application to use
296+
certificates as well as TLS/SSL options, see our
297+
:ref:`TLS/SSL guide <kotlin-sync-tls>`.
298+
235299
.. _kotlin-sync-auth-aws:
236300

237301
MONGODB-AWS
@@ -480,70 +544,6 @@ method:
480544
:end-before: end-aws-apply-connect-string
481545
:emphasize-lines: 2, 5
482546

483-
.. _kotlin-sync-auth-x509:
484-
485-
MONGODB-X509
486-
------------
487-
488-
The ``X.509`` authentication mechanism uses
489-
:wikipedia:`TLS <Transport_Layer_Security>` with X.509 certificates to
490-
authenticate your user, identified by the relative distinguished names
491-
(RDNs) of your client certificate. When you specify the ``X.509``
492-
authentication mechanism, the server authenticates the connection using
493-
the subject name of the client certificate.
494-
495-
The following code snippets show how to specify the authentication mechanism,
496-
using the following placeholders:
497-
498-
* ``hostname`` - network address of your MongoDB server, accessible by your client.
499-
* ``port`` - port number of your MongoDB server.
500-
* ``authenticationDb`` - MongoDB database that contains your user's
501-
authentication data. If you omit this parameter, the driver uses the
502-
default value ``admin``.
503-
504-
Select the :guilabel:`Connection String` or the :guilabel:`MongoCredential`
505-
tab below for instructions and sample code for specifying this authentication
506-
mechanism:
507-
508-
.. tabs::
509-
510-
.. tab::
511-
:tabid: Connection String
512-
513-
To specify the ``X.509`` authentication mechanism using a connection
514-
string, assign the ``authMechanism`` parameter the value ``MONGODB-X509``
515-
and enable TLS by assigning the ``tls``
516-
parameter a ``true`` value. Your code to instantiate a ``MongoClient``
517-
should resemble the following:
518-
519-
.. literalinclude:: /includes/security/authentication.kt
520-
:language: kotlin
521-
:dedent:
522-
:start-after: start-x509-connect-string
523-
:end-before: end-x509-connect-string
524-
525-
.. tab::
526-
:tabid: MongoCredential
527-
528-
To specify the ``X.509`` authentication mechanism using the
529-
``MongoCredential`` class, use the
530-
`createMongoX509Credential() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoCredential.html#createMongoX509Credential(java.lang.String)>`__
531-
method. Also, enable TLS by calling the
532-
`applyToSslSettings() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoClientSettings.Builder.html#applyToSslSettings(com.mongodb.Block)>`__
533-
method and setting the ``enabled`` property to ``true`` in the
534-
`SslSettings.Builder <{+api+}/apidocs/mongodb-driver-core/com/mongodb/connection/SslSettings.Builder.html>`__
535-
block. Your code to instantiate a ``MongoClient`` should resemble the following:
536-
537-
.. literalinclude:: /includes/security/authentication.kt
538-
:language: kotlin
539-
:dedent:
540-
:start-after: start-x509-mcred
541-
:end-before: end-x509-mcred
542-
543-
For additional information on configuring your application to use
544-
certificates as well as TLS/SSL options, see our
545-
:ref:`TLS/SSL guide <kotlin-sync-tls>`.
546-
547547
Additional Information
548548
----------------------
549549

0 commit comments

Comments
 (0)