Skip to content

Commit ba037a3

Browse files
author
Chris Cho
authored
DOCSP-9032: feedback fixes for auth guides (#70)
1 parent 3531c62 commit ba037a3

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

source/fundamentals/authentication/enterprise-mechanisms.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ authenticate to a Kerberos service.
1818

1919
You can specify this authentication mechanism by setting the following
2020
parameters of the
21-
:manual:`URI ConnectionString </reference/connection-string/>`:
21+
:manual:`connection string </reference/connection-string/>`:
2222

2323
- Set the ``authMechanism`` parameter to ``GSSAPI``
2424
- Set the ``gssapiServiceName`` if using a value other than ``mongodb``
@@ -27,6 +27,10 @@ parameters of the
2727

2828
The following code sample authenticates to Kerberos for UNIX using ``GSSAPI``.
2929

30+
.. important::
31+
Always **URI encode** the principal using the ``encodeURIComponent`` method
32+
to ensure it is correctly parsed.
33+
3034
.. code-block:: js
3135

3236
const { MongoClient } = require("mongodb");
@@ -74,7 +78,7 @@ authenticate to a Lightweight Directory Access Protocol (LDAP) server.
7478

7579
You can specify this authentication mechanism by setting the ``authMechanism``
7680
parameter to ``PLAIN`` and including your LDAP username and password in the
77-
:manual:`URI ConnectionString </reference/connection-string/>` as shown
81+
:manual:`connection string </reference/connection-string/>` as shown
7882
in the following sample code.
7983

8084
.. code-block:: js

source/fundamentals/authentication/mechanisms.txt

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ the driver attempts to authenticate using ``MONGODB-CR``.
3333

3434
You can specify this authentication mechanism by setting the ``authMechanism``
3535
parameter to ``DEFAULT`` in the
36-
:manual:`URI ConnectionString </reference/connection-string/>`, or by omitting
36+
:manual:`connection string </reference/connection-string/>`, or by omitting
3737
the parameter since it is the default value. Also include your username and
3838
password as shown in the code below.
3939

@@ -63,9 +63,13 @@ algorithm to authenticate your user.
6363

6464
You can specify this authentication mechanism by setting the ``authMechanism``
6565
to the value ``SCRAM-SHA-256`` in the
66-
:manual:`URI ConnectionString </reference/connection-string/>` as shown in the
66+
:manual:`connection string <reference/connection-string/>` as shown in the
6767
following sample code.
6868

69+
.. important::
70+
Always **URI encode** the username and password using the
71+
``encodeURIComponent`` method to ensure they are correctly parsed.
72+
6973
.. literalinclude:: /code-snippets/authentication/sha256.js
7074
:language: javascript
7175
:dedent: 4
@@ -83,9 +87,13 @@ your user.
8387

8488
You can specify this authentication mechanism by setting the ``authMechanism``
8589
parameter to the value ``SCRAM-SHA-1`` in the
86-
:manual:`URI ConnectionString </reference/connection-string/>` as shown
90+
:manual:`connection string </reference/connection-string/>` as shown
8791
in the following sample code.
8892

93+
.. important::
94+
Always **URI encode** the username and password using the
95+
``encodeURIComponent`` method to ensure they are correctly parsed.
96+
8997
.. literalinclude:: /code-snippets/authentication/sha1.js
9098
:language: javascript
9199
:dedent: 4
@@ -101,9 +109,13 @@ username and password to authenticate your user.
101109

102110
You can specify this option by setting the ``authMechanism`` parameter to value
103111
``MONGODB-CR`` in the
104-
:manual:`URI ConnectionString </reference/connection-string/>` as shown
112+
:manual:`connection string </reference/connection-string/>` as shown
105113
in the following sample code.
106114

115+
.. important::
116+
Always **URI encode** the username and password using the
117+
``encodeURIComponent`` method to ensure they are correctly parsed.
118+
107119
.. literalinclude:: /code-snippets/authentication/cr.js
108120
:language: javascript
109121
:dedent: 4
@@ -129,14 +141,18 @@ the X.509 certificate, see the MongoDB manual :manual:`X.509 tutorial
129141

130142
You can specify this authentication mechanism by setting the following
131143
parameters of your
132-
:manual:`URI ConnectionString </reference/connection-string/>`:
144+
:manual:`connection string </reference/connection-string/>`:
133145

134146
- Set the ``authMechanism`` parameter to the value ``MONGODB-X509``
135147
- Set the ``tls`` parameter to the value ``true``
136148

137149
Pass the location of your client certificate file as the value of
138150
``tlsCertificateKeyFile`` as a parameter of the connection URI.
139151

152+
.. important::
153+
Always **URI encode** the username and certificate file path using the
154+
``encodeURIComponent`` method to ensure they are correctly parsed.
155+
140156
.. literalinclude:: /code-snippets/authentication/x509.js
141157
:language: javascript
142158
:dedent: 4

0 commit comments

Comments
 (0)