@@ -23,10 +23,7 @@ confirm identity and establish trust to ensure security.
2323The mechanisms that you can use with the latest version of MongoDB Community
2424Edition are as follows:
2525
26- * :ref:`Default <default-auth-mechanism>`
2726* :ref:`SCRAM-SHA-256 <scram-sha-256-auth-mechanism>`
28- * :ref:`SCRAM-SHA-1 <scram-sha-1-auth-mechanism>`
29- * :ref:`MONGODB-CR <mongodb-cr-auth-mechanism>`
3027* :ref:`MONGODB-AWS <mongodb-aws-auth-mechanism>`
3128* :ref:`X.509 <x509-auth-mechanism>`
3229
@@ -45,38 +42,31 @@ Mechanisms
4542----------
4643
4744.. _default-auth-mechanism:
45+ .. _scram-sha-256-auth-mechanism:
4846
49- Default
50- ~~~~~~~
51-
52- The default authentication mechanism setting uses one of the following
53- authentication mechanisms depending on what your MongoDB server supports:
54-
55- #. ``SCRAM-SHA-256``
56- #. ``SCRAM-SHA-1``
57- #. ``MONGODB-CR``
47+ SCRAM-SHA-256
48+ ~~~~~~~~~~~~~
5849
59- Server versions 3.6 and earlier use ``MONGODB-CR`` as the default
60- mechanism. Newer versions of the server use one of the mechanisms for
61- which they advertise support.
50+ ``SCRAM-SHA-256`` is a salted challenge-response authentication mechanism
51+ (SCRAM) that uses your username and password, encrypted with the ``SHA-256``
52+ algorithm, to authenticate your user. This is the default authentication
53+ mechanism.
6254
6355The following code snippets show how to specify the authentication mechanism,
6456using the following placeholders:
6557
66- * ``db_username`` - your MongoDB database username
67- * ``db_password`` - your MongoDB database user's password
68- * ``hostname`` - network address of your MongoDB server, accessible by your client
69- * ``port`` - port number of your MongoDB server
58+ * ``db_username`` - your MongoDB database username.
59+ * ``db_password`` - your MongoDB database user's password.
60+ * ``hostname`` - network address of your MongoDB server, accessible by your client.
61+ * ``port`` - port number of your MongoDB server.
7062* ``authenticationDb`` - MongoDB database that contains your user's
7163 authentication data. If you omit this parameter, the driver uses the
7264 default value ``admin``.
7365
7466Select the :guilabel:`Connection String` or the :guilabel:`MongoCredential`
75- tab below for instructions and sample code for specifying this authentication
67+ tab below for instructions and sample code to specify this default authentication
7668mechanism:
7769
78- .. _mongo-client-setting-with-mongo-credential-example:
79-
8070.. tabs::
8171
8272 .. tab::
@@ -99,38 +89,10 @@ mechanism:
9989 .. literalinclude:: /examples/generated/AuthTest.snippet.default-mongo-cred.kt
10090 :language: kotlin
10191
102- For more information on the challenge-response (CR) and salted
103- challenge-response authentication mechanisms (SCRAM) that MongoDB supports,
104- see the :manual:`SCRAM </core/security-scram/>` section of the Server manual.
105-
106- .. _scram-sha-256-auth-mechanism:
107-
108- ``SCRAM-SHA-256``
109- ~~~~~~~~~~~~~~~~~
110-
111- .. note::
112-
113- ``SCRAM-SHA-256`` is the default authentication method for MongoDB starting
114- in MongoDB 4.0.
115-
116- ``SCRAM-SHA-256`` is a salted challenge-response authentication mechanism
117- (SCRAM) that uses your username and password, encrypted with the ``SHA-256``
118- algorithm, to authenticate your user.
119-
120- The following code snippets show how to specify the authentication mechanism,
121- using the following placeholders:
122-
123- * ``db_username`` - your MongoDB database username.
124- * ``db_password`` - your MongoDB database user's password.
125- * ``hostname`` - network address of your MongoDB server, accessible by your client.
126- * ``port`` - port number of your MongoDB server.
127- * ``authenticationDb`` - MongoDB database that contains your user's
128- authentication data. If you omit this parameter, the driver uses the
129- default value ``admin``.
130-
131- Select the :guilabel:`Connection String` or the :guilabel:`MongoCredential`
132- tab below for instructions and sample code for specifying this authentication
133- mechanism:
92+ You can also explicitly specify the ``SCRAM-SHA-256`` authentication mechanism,
93+ as shown in the following code snippets. Select the :guilabel:`Connection String`
94+ or the :guilabel:`MongoCredential` tab below for instructions and sample code for
95+ specifying this authentication mechanism:
13496
13597.. tabs::
13698
@@ -156,76 +118,10 @@ mechanism:
156118 .. literalinclude:: /examples/generated/AuthTest.snippet.scram-sha-256-cred.kt
157119 :language: kotlin
158120
159- .. _scram-sha-1-auth-mechanism:
160-
161- ``SCRAM-SHA-1``
162- ~~~~~~~~~~~~~~~
163-
164- .. note::
165- ``SCRAM-SHA-1`` is the default authentication method for MongoDB versions
166- 3.0, 3.2, 3.4, and 3.6.
167-
168- ``SCRAM-SHA-1`` is a salted challenge-response mechanism (SCRAM) that uses your
169- username and password, encrypted with the ``SHA-1`` algorithm, to authenticate
170- your user.
171-
172- The following code snippets show how to specify the authentication mechanism,
173- using the following placeholders:
174-
175- * ``db_username`` - your MongoDB database username.
176- * ``db_password`` - your MongoDB database user's password.
177- * ``hostname`` - network address of your MongoDB server, accessible by your client.
178- * ``port`` - port number of your MongoDB server.
179- * ``authenticationDb`` - MongoDB database that contains your user's
180- authentication data. If you omit this parameter, the driver uses the
181- default value ``admin``.
182-
183- Select the :guilabel:`Connection String` or the :guilabel:`MongoCredential`
184- tab below for instructions and sample code for specifying this authentication
185- mechanism:
186-
187- .. tabs::
188-
189- .. tab::
190- :tabid: Connection String
191-
192- To specify the ``SCRAM-SHA-1`` authentication mechanism using a
193- connection string, assign the ``authMechanism`` parameter the value
194- ``SCRAM-SHA-1`` in your connection string. Your code to instantiate
195- a ``MongoClient`` should resemble the following:
196-
197- .. literalinclude:: /examples/generated/AuthTest.snippet.scram-sha-1-string.kt
198- :language: kotlin
199-
200- .. tab::
201- :tabid: MongoCredential
202-
203- To specify the default authentication mechanism using the
204- ``MongoCredential`` class, use the
205- `createScramSha1Credential() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoCredential.html#createScramSha1Credential(java.lang.String,java.lang.String,char[])>`__
206- method. Your code to instantiate a ``MongoClient`` should resemble the following:
207-
208- .. literalinclude:: /examples/generated/AuthTest.snippet.scram-sha-1-cred.kt
209- :language: kotlin
210-
211- .. _mongodb-cr-auth-mechanism:
212-
213- ``MONGODB-CR``
214- ~~~~~~~~~~~~~~
215-
216- ``MONGODB-CR`` is a challenge-response authentication mechanism that uses your
217- username and password to authenticate your user. This authentication
218- mechanism was deprecated starting in MongoDB 3.6 and is no longer
219- supported as of MongoDB 4.0.
220-
221- You cannot specify this method explicitly; refer to the fallback provided
222- by the :ref:`default authentication mechanism <default-auth-mechanism>` to
223- connect using ``MONGODB-CR``.
224-
225121.. _mongodb-aws-auth-mechanism:
226122
227- `` MONGODB-AWS``
228- ~~~~~~~~~~~~~~~
123+ MONGODB-AWS
124+ ~~~~~~~~~~~
229125
230126.. note::
231127
@@ -448,8 +344,8 @@ method:
448344
449345.. _x509-auth-mechanism:
450346
451- `` X.509``
452- ~~~~~~~~~
347+ X.509
348+ ~~~~~
453349
454350The ``X.509`` authentication mechanism uses
455351:wikipedia:`TLS <Transport_Layer_Security>` with X.509 certificates to
0 commit comments