@@ -26,10 +26,7 @@ confirm identity and establish trust to ensure security.
26
26
The mechanisms that you can use with the latest version of MongoDB Community
27
27
Edition are as follows:
28
28
29
- * :ref:`Default <default-auth-mechanism>`
30
29
* :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>`
33
30
* :ref:`MONGODB-AWS <mongodb-aws-auth-mechanism>`
34
31
* :ref:`X.509 <x509-auth-mechanism>`
35
32
@@ -48,38 +45,31 @@ Mechanisms
48
45
----------
49
46
50
47
.. _default-auth-mechanism:
48
+ .. _scram-sha-256-auth-mechanism:
51
49
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
+ ~~~~~~~~~~~~~
61
52
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.
65
57
66
58
The following code snippets show how to specify the authentication mechanism,
67
59
using the following placeholders:
68
60
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.
73
65
* ``authenticationDb`` - MongoDB database that contains your user's
74
66
authentication data. If you omit this parameter, the driver uses the
75
67
default value ``admin``.
76
68
77
69
Select 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
79
71
mechanism:
80
72
81
- .. _mongo-client-setting-with-mongo-credential-example:
82
-
83
73
.. tabs::
84
74
85
75
.. tab::
@@ -102,38 +92,10 @@ mechanism:
102
92
.. literalinclude:: /examples/generated/AuthTest.snippet.default-mongo-cred.kt
103
93
:language: kotlin
104
94
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:
137
99
138
100
.. tabs::
139
101
@@ -159,76 +121,10 @@ mechanism:
159
121
.. literalinclude:: /examples/generated/AuthTest.snippet.scram-sha-256-cred.kt
160
122
:language: kotlin
161
123
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
-
228
124
.. _mongodb-aws-auth-mechanism:
229
125
230
- `` MONGODB-AWS``
231
- ~~~~~~~~~~~~~~~
126
+ MONGODB-AWS
127
+ ~~~~~~~~~~~
232
128
233
129
.. note::
234
130
@@ -451,8 +347,8 @@ method:
451
347
452
348
.. _x509-auth-mechanism:
453
349
454
- `` X.509``
455
- ~~~~~~~~~
350
+ X.509
351
+ ~~~~~
456
352
457
353
The ``X.509`` authentication mechanism uses
458
354
:wikipedia:`TLS <Transport_Layer_Security>` with X.509 certificates to
0 commit comments