@@ -23,10 +23,7 @@ confirm identity and establish trust to ensure security.
23
23
The mechanisms that you can use with the latest version of MongoDB Community
24
24
Edition are as follows:
25
25
26
- * :ref:`Default <default-auth-mechanism>`
27
26
* :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>`
30
27
* :ref:`MONGODB-AWS <mongodb-aws-auth-mechanism>`
31
28
* :ref:`X.509 <x509-auth-mechanism>`
32
29
@@ -45,38 +42,31 @@ Mechanisms
45
42
----------
46
43
47
44
.. _default-auth-mechanism:
45
+ .. _scram-sha-256-auth-mechanism:
48
46
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
+ ~~~~~~~~~~~~~
58
49
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.
62
54
63
55
The following code snippets show how to specify the authentication mechanism,
64
56
using the following placeholders:
65
57
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.
70
62
* ``authenticationDb`` - MongoDB database that contains your user's
71
63
authentication data. If you omit this parameter, the driver uses the
72
64
default value ``admin``.
73
65
74
66
Select 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
76
68
mechanism:
77
69
78
- .. _mongo-client-setting-with-mongo-credential-example:
79
-
80
70
.. tabs::
81
71
82
72
.. tab::
@@ -99,38 +89,10 @@ mechanism:
99
89
.. literalinclude:: /examples/generated/AuthTest.snippet.default-mongo-cred.kt
100
90
:language: kotlin
101
91
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:
134
96
135
97
.. tabs::
136
98
@@ -156,76 +118,10 @@ mechanism:
156
118
.. literalinclude:: /examples/generated/AuthTest.snippet.scram-sha-256-cred.kt
157
119
:language: kotlin
158
120
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
-
225
121
.. _mongodb-aws-auth-mechanism:
226
122
227
- `` MONGODB-AWS``
228
- ~~~~~~~~~~~~~~~
123
+ MONGODB-AWS
124
+ ~~~~~~~~~~~
229
125
230
126
.. note::
231
127
@@ -448,8 +344,8 @@ method:
448
344
449
345
.. _x509-auth-mechanism:
450
346
451
- `` X.509``
452
- ~~~~~~~~~
347
+ X.509
348
+ ~~~~~
453
349
454
350
The ``X.509`` authentication mechanism uses
455
351
:wikipedia:`TLS <Transport_Layer_Security>` with X.509 certificates to
0 commit comments