Skip to content

Commit aa52cdf

Browse files
committed
edit
1 parent 9f1dd74 commit aa52cdf

File tree

2 files changed

+76
-37
lines changed

2 files changed

+76
-37
lines changed

source/security/authentication/aws-iam.txt

Lines changed: 71 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -72,31 +72,53 @@ The AWS SDK offers the following features:
7272
To use the AWS SDK for ``MONGODB-AWS`` authentication, perform
7373
the following steps:
7474

75-
1. Specify the authentication mechanism.
76-
#. Add the SDK as a dependency to your project.
77-
#. Supply your credentials by using one of the methods in the credential
78-
provider chain.
75+
1. :ref:`Specify the authentication mechanism <kotlin-mongodb-aws-sdk-specify>`.
76+
#. :ref:`Add the SDK as a dependency to your project <kotlin-mongodb-aws-sdk-dependency>`.
77+
#. :ref:`Supply your credentials by using one of the methods in the credential provider chain <kotlin-mongodb-aws-sdk-credentials>`.
7978

80-
To specify the ``MONGODB-AWS`` authentication mechanism by using a ``MongoCredential``
81-
object, call the ``MongoCredential.createAwsCredential()`` factory method
82-
and add the ``MongoCredential`` instance to your ``MongoClient``, as shown
83-
in the following example:
79+
.. _kotlin-mongodb-aws-sdk-specify:
8480

85-
.. literalinclude:: /includes/security/authentication.kt
86-
:language: kotlin
87-
:dedent:
88-
:start-after: start-aws-sdk-mcred
89-
:end-before: end-aws-sdk-mcred
90-
:emphasize-lines: 1, 9
81+
Specify the Authentication Mechanism
82+
````````````````````````````````````
9183

92-
To specify the ``MONGODB-AWS`` authentication mechanism in the connection string,
93-
add it as a parameter, as shown in the following example:
84+
You can specify the ``MONGODB-AWS`` authentication mechanism by using a connection
85+
string or a ``MongoCredential`` object. Select the :guilabel:`Connection String`
86+
or the :guilabel:`MongoCredential` tab below for corresponding instructions and sample code:
9487

95-
.. literalinclude:: /includes/security/authentication.kt
96-
:language: kotlin
97-
:dedent:
98-
:start-after: start-aws-sdk-cred-string
99-
:end-before: end-aws-sdk-cred-string
88+
.. tabs::
89+
90+
.. tab::
91+
:tabid: Connection String
92+
93+
To specify the ``MONGODB-AWS`` authentication mechanism in the connection string,
94+
set the ``authMechanism`` parameter to ``MONGODB-AWS``, as shown in the following
95+
example:
96+
97+
.. literalinclude:: /includes/security/authentication.kt
98+
:language: kotlin
99+
:dedent:
100+
:start-after: start-aws-sdk-cred-string
101+
:end-before: end-aws-sdk-cred-string
102+
103+
.. tab::
104+
:tabid: MongoCredential
105+
106+
To specify the ``MONGODB-AWS`` authentication mechanism by using a ``MongoCredential``
107+
object, call the ``MongoCredential.createAwsCredential()`` factory method
108+
and add the ``MongoCredential`` instance to your ``MongoClient``, as shown
109+
in the following example:
110+
111+
.. literalinclude:: /includes/security/authentication.kt
112+
:language: kotlin
113+
:dedent:
114+
:start-after: start-aws-sdk-mcred
115+
:end-before: end-aws-sdk-mcred
116+
:emphasize-lines: 1, 9
117+
118+
.. _kotlin-mongodb-aws-sdk-dependency:
119+
120+
Add the AWS SDK Dependency
121+
``````````````````````````
100122

101123
To add the AWS SDK as a dependency to your project, see the following
102124
AWS documentation for the version you need:
@@ -114,6 +136,11 @@ AWS documentation for the version you need:
114136
For the AWS SDK for Java v1, the Java driver currently tests by using the
115137
``com.amazonaws:aws-java-sdk-core:1.12.782`` dependency.
116138

139+
.. _kotlin-mongodb-aws-sdk-credentials:
140+
141+
Supply Your Credentials
142+
```````````````````````
143+
117144
To supply your credentials, see the following AWS documentation for the
118145
version you need:
119146

@@ -150,8 +177,13 @@ appropriate environment variables.
150177
To use the environment variables to supply your credentials, perform
151178
the following steps:
152179

153-
1. Specify the authentication mechanism.
154-
#. Add the appropriate environment variables.
180+
1. :ref:`Specify the authentication mechanism <kotlin-mongodb-aws-env-specify>`.
181+
#. :ref:`Add the appropriate environment variables <kotlin-mongodb-aws-env-set-vars>`.
182+
183+
.. _kotlin-mongodb-aws-env-specify:
184+
185+
Specify the Authentication Mechanism
186+
````````````````````````````````````
155187

156188
You can specify the ``MONGODB-AWS`` authentication mechanism by using a
157189
``MongoCredential`` object or in the connection string.
@@ -177,7 +209,12 @@ string, add it as a parameter as shown in the following example:
177209
:start-after: start-aws-env-cred-string
178210
:end-before: end-aws-env-cred-string
179211

180-
The next examples show how to provide your credentials by setting environment
212+
.. _kotlin-mongodb-aws-env-set-vars:
213+
214+
Set Environment Variables
215+
`````````````````````````
216+
217+
This section shows how to provide your credentials by setting environment
181218
variables for the following types of authentication:
182219

183220
- Programmatic access keys
@@ -204,9 +241,9 @@ a similar shell, as shown in the following example:
204241

205242
export AWS_CONTAINER_CREDENTIALS_RELATIVE_URI=<your ECS endpoint>
206243

207-
To authenticate by using **EC2 container credentials**, make sure none of the
208-
aforementioned environment variables are set. The driver obtains the
209-
credentials from the default IPv4 EC2 instance metadata endpoint.
244+
To authenticate by using **EC2 container credentials**, do not set
245+
the AWS environment variables. The driver obtains the credentials
246+
from the default IPv4 EC2 instance metadata endpoint.
210247

211248
.. _kotlin-mongodb-aws-mongoclient-configuration:
212249

@@ -219,10 +256,12 @@ for ``MONGODB-AWS`` authentication, call the
219256
`createAwsCredential() <{+core-api+}/MongoCredential.html#createAwsCredential(java.lang.String,char%5B%5D)>`__
220257
factory method.
221258

222-
You can supply only programmatic access keys to the
223-
``MongoCredential.createAwsCredential()`` method. If you need to supply ECS
224-
or EC2 container credentials, follow the instructions in
225-
:ref:`<kotlin-mongodb-aws-env-variables>` or :ref:`<kotlin-mongodb-aws-sdk>`.
259+
.. tip::
260+
261+
You can supply only programmatic access keys to the
262+
``MongoCredential.createAwsCredential()`` method. If you need to supply ECS
263+
or EC2 container credentials, follow the instructions in
264+
:ref:`<kotlin-mongodb-aws-env-variables>`.
226265

227266
To use a ``MongoCredential`` object for ``MONGODB-AWS`` authentication, perform
228267
the following steps:
@@ -242,7 +281,7 @@ in the following example:
242281
:end-before: end-aws-mcred
243282
:emphasize-lines: 1, 9
244283

245-
If you need to specify an AWS session token, pass it to the
284+
If you must specify an AWS session token, pass it to the
246285
`withMechanismProperty() <{+core-api+}/MongoCredential.html#withMechanismProperty(java.lang.String,T)>`__
247286
method, as shown in the following example:
248287

source/security/authentication/scram.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ Overview
2222

2323
**Salted Challenge Response Authentication Mechanism (SCRAM)** is a family of
2424
authentication mechanisms that use a challenge-response mechanism to authenticate
25-
the user. SCRAM-SHA-256, which uses the SHA-256 algorithm to hash your password, is the
25+
the user. ``SCRAM-SHA-256``, which uses the ``SHA-256`` algorithm to hash your password, is the
2626
default authentication mechanism in {+mdb-server+} version 4.0
27-
and later. SCRAM-SHA-1, which uses the SHA-1 algorithm instead, is the default
27+
and later. ``SCRAM-SHA-1``, which uses the ``SHA-1`` algorithm, is the default
2828
authentication mechanism in {+mdb-server+} versions earlier than 4.0.
2929

30-
You can use SCRAM to authenticate to MongoDB Atlas, MongoDB
30+
You can use ``SCRAM`` to authenticate to MongoDB Atlas, MongoDB
3131
Enterprise Advanced, and MongoDB Community Edition.
3232

3333
.. tip:: SCRAM Mechanisms
3434

35-
To learn more about the SCRAM family of authentication mechanisms, see
35+
To learn more about the ``SCRAM`` family of authentication mechanisms, see
3636
`RFC 5802 <https://tools.ietf.org/html/rfc5802>`__ and
3737
:wikipedia:`Salted Challenge Response Authentication Mechanism <Salted_Challenge_Response_Authentication_Mechanism>`
3838
on Wikipedia.
3939

40-
For more information about the MongoDB implementation of SCRAM, see
40+
For more information about the MongoDB implementation of ``SCRAM``, see
4141
:manual:`SCRAM </core/security-scram>` in the {+mdb-server+} manual.
4242

4343
.. _kotlin-sync-auth-default:

0 commit comments

Comments
 (0)