@@ -26,10 +26,7 @@ confirm identity and establish trust to ensure security.
2626The mechanisms that you can use with the latest version of MongoDB Community
2727Edition are as follows:
2828
29- * :ref:`Default <default-auth-mechanism>`
3029* :ref:`SCRAM-SHA-256 <scram-sha-256-auth-mechanism>`
31- * :ref:`SCRAM-SHA-1 <scram-sha-1-auth-mechanism>`
32- * :ref:`MONGODB-CR <mongodb-cr-auth-mechanism>`
3330* :ref:`MONGODB-AWS <mongodb-aws-auth-mechanism>`
3431* :ref:`X.509 <x509-auth-mechanism>`
3532
@@ -48,38 +45,31 @@ Mechanisms
4845----------
4946
5047.. _default-auth-mechanism:
48+ .. _scram-sha-256-auth-mechanism:
5149
52- Default
53- ~~~~~~~
54-
55- The default authentication mechanism setting uses one of the following
56- authentication mechanisms depending on what your MongoDB server supports:
57-
58- #. ``SCRAM-SHA-256``
59- #. ``SCRAM-SHA-1``
60- #. ``MONGODB-CR``
50+ SCRAM-SHA-256
51+ ~~~~~~~~~~~~~
6152
62- Server versions 3.6 and earlier use ``MONGODB-CR`` as the default
63- mechanism. Newer versions of the server use one of the mechanisms for
64- which they advertise support.
53+ ``SCRAM-SHA-256`` is a salted challenge-response authentication mechanism
54+ (SCRAM) that uses your username and password, encrypted with the ``SHA-256``
55+ algorithm, to authenticate your user. This is the default authentication
56+ mechanism.
6557
6658The following code snippets show how to specify the authentication mechanism,
6759using the following placeholders:
6860
69- * ``db_username`` - your MongoDB database username
70- * ``db_password`` - your MongoDB database user's password
71- * ``hostname`` - network address of your MongoDB server, accessible by your client
72- * ``port`` - port number of your MongoDB server
61+ * ``db_username`` - your MongoDB database username.
62+ * ``db_password`` - your MongoDB database user's password.
63+ * ``hostname`` - network address of your MongoDB server, accessible by your client.
64+ * ``port`` - port number of your MongoDB server.
7365* ``authenticationDb`` - MongoDB database that contains your user's
7466 authentication data. If you omit this parameter, the driver uses the
7567 default value ``admin``.
7668
7769Select the :guilabel:`Connection String` or the :guilabel:`MongoCredential`
78- tab below for instructions and sample code for specifying this authentication
70+ tab below for instructions and sample code to specify this default authentication
7971mechanism:
8072
81- .. _mongo-client-setting-with-mongo-credential-example:
82-
8373.. tabs::
8474
8575 .. tab::
@@ -102,38 +92,10 @@ mechanism:
10292 .. literalinclude:: /examples/generated/AuthTest.snippet.default-mongo-cred.kt
10393 :language: kotlin
10494
105- For more information on the challenge-response (CR) and salted
106- challenge-response authentication mechanisms (SCRAM) that MongoDB supports,
107- see the :manual:`SCRAM </core/security-scram/>` section of the Server manual.
108-
109- .. _scram-sha-256-auth-mechanism:
110-
111- ``SCRAM-SHA-256``
112- ~~~~~~~~~~~~~~~~~
113-
114- .. note::
115-
116- ``SCRAM-SHA-256`` is the default authentication method for MongoDB starting
117- in MongoDB 4.0.
118-
119- ``SCRAM-SHA-256`` is a salted challenge-response authentication mechanism
120- (SCRAM) that uses your username and password, encrypted with the ``SHA-256``
121- algorithm, to authenticate your user.
122-
123- The following code snippets show how to specify the authentication mechanism,
124- using the following placeholders:
125-
126- * ``db_username`` - your MongoDB database username.
127- * ``db_password`` - your MongoDB database user's password.
128- * ``hostname`` - network address of your MongoDB server, accessible by your client.
129- * ``port`` - port number of your MongoDB server.
130- * ``authenticationDb`` - MongoDB database that contains your user's
131- authentication data. If you omit this parameter, the driver uses the
132- default value ``admin``.
133-
134- Select the :guilabel:`Connection String` or the :guilabel:`MongoCredential`
135- tab below for instructions and sample code for specifying this authentication
136- mechanism:
95+ You can also explicitly specify the ``SCRAM-SHA-256`` authentication mechanism,
96+ as shown in the following code snippets. Select the :guilabel:`Connection String`
97+ or the :guilabel:`MongoCredential` tab below for instructions and sample code for
98+ specifying this authentication mechanism:
13799
138100.. tabs::
139101
@@ -159,76 +121,10 @@ mechanism:
159121 .. literalinclude:: /examples/generated/AuthTest.snippet.scram-sha-256-cred.kt
160122 :language: kotlin
161123
162- .. _scram-sha-1-auth-mechanism:
163-
164- ``SCRAM-SHA-1``
165- ~~~~~~~~~~~~~~~
166-
167- .. note::
168- ``SCRAM-SHA-1`` is the default authentication method for MongoDB versions
169- 3.0, 3.2, 3.4, and 3.6.
170-
171- ``SCRAM-SHA-1`` is a salted challenge-response mechanism (SCRAM) that uses your
172- username and password, encrypted with the ``SHA-1`` algorithm, to authenticate
173- your user.
174-
175- The following code snippets show how to specify the authentication mechanism,
176- using the following placeholders:
177-
178- * ``db_username`` - your MongoDB database username.
179- * ``db_password`` - your MongoDB database user's password.
180- * ``hostname`` - network address of your MongoDB server, accessible by your client.
181- * ``port`` - port number of your MongoDB server.
182- * ``authenticationDb`` - MongoDB database that contains your user's
183- authentication data. If you omit this parameter, the driver uses the
184- default value ``admin``.
185-
186- Select the :guilabel:`Connection String` or the :guilabel:`MongoCredential`
187- tab below for instructions and sample code for specifying this authentication
188- mechanism:
189-
190- .. tabs::
191-
192- .. tab::
193- :tabid: Connection String
194-
195- To specify the ``SCRAM-SHA-1`` authentication mechanism using a
196- connection string, assign the ``authMechanism`` parameter the value
197- ``SCRAM-SHA-1`` in your connection string. Your code to instantiate
198- a ``MongoClient`` should resemble the following:
199-
200- .. literalinclude:: /examples/generated/AuthTest.snippet.scram-sha-1-string.kt
201- :language: kotlin
202-
203- .. tab::
204- :tabid: MongoCredential
205-
206- To specify the default authentication mechanism using the
207- ``MongoCredential`` class, use the
208- `createScramSha1Credential() <{+core-api+}/MongoCredential.html#createScramSha1Credential(java.lang.String,java.lang.String,char[])>`__
209- method. Your code to instantiate a ``MongoClient`` should resemble the following:
210-
211- .. literalinclude:: /examples/generated/AuthTest.snippet.scram-sha-1-cred.kt
212- :language: kotlin
213-
214- .. _mongodb-cr-auth-mechanism:
215-
216- ``MONGODB-CR``
217- ~~~~~~~~~~~~~~
218-
219- ``MONGODB-CR`` is a challenge-response authentication mechanism that uses your
220- username and password to authenticate your user. This authentication
221- mechanism was deprecated starting in MongoDB 3.6 and is no longer
222- supported as of MongoDB 4.0.
223-
224- You cannot specify this method explicitly; refer to the fallback provided
225- by the :ref:`default authentication mechanism <default-auth-mechanism>` to
226- connect using ``MONGODB-CR``.
227-
228124.. _mongodb-aws-auth-mechanism:
229125
230- `` MONGODB-AWS``
231- ~~~~~~~~~~~~~~~
126+ MONGODB-AWS
127+ ~~~~~~~~~~~
232128
233129.. note::
234130
@@ -451,8 +347,8 @@ method:
451347
452348.. _x509-auth-mechanism:
453349
454- `` X.509``
455- ~~~~~~~~~
350+ X.509
351+ ~~~~~
456352
457353The ``X.509`` authentication mechanism uses
458354:wikipedia:`TLS <Transport_Layer_Security>` with X.509 certificates to
0 commit comments