@@ -129,7 +129,7 @@ authentication mechanism to authenticate to various platforms.
129129To learn more about the MONGODB-OIDC authentication mechanism, see
130130:manual:`OpenID Connect Authentication </core/security-oidc/>` and
131131:manual:`MongoDB Server Parameters </reference/parameters/#mongodb-parameter-param.oidcIdentityProviders>`
132- in the server manual.
132+ in the {+ server+} manual.
133133
134134.. _rust-mongodb-oidc-azure-imds:
135135
@@ -142,17 +142,21 @@ If your application runs on an Azure VM, or otherwise uses the
142142built-in Azure support.
143143
144144You can configure OIDC for Azure IMDS by setting the ``mechanism`` field of your
145- ``Credential`` struct to ``AuthMechanism::MongoDBOidc``. The following example
146- specifies the authentication mechanism by using the following placeholders:
145+ ``Credential`` struct to ``AuthMechanism::MongoDBOidc``. Then, specify the
146+ authentication mechanism by seting the following values in the
147+ ``mechanism_properties`` field:
147148
148149- ``username``: If you're using an Azure managed identity, set this to the
149150 client ID of the managed identity. If you're using a service principal to
150151 represent an enterprise application, set this to the application ID of the
151152 service principal.
152153- ``mechanism_properties``: Set the ``ENVIRONMENT`` property to ``azure`` and
153- the ``TOKEN_RESOURCE`` to with the value of the audience parameter configured
154+ the ``TOKEN_RESOURCE`` to the value of the audience parameter configured
154155 on your MongoDB deployment.
155156
157+ The following code example shows how to set these options when creating a
158+ ``Client``:
159+
156160.. literalinclude:: /includes/fundamentals/code-snippets/enterprise-auth.rs
157161 :language: rust
158162 :dedent:
@@ -194,16 +198,15 @@ The following code example shows how to set these options when creating a
194198Custom Callback
195199~~~~~~~~~~~~~~~
196200
197- The {+driver-short+} doesn't offer built-in support for all platforms,
198- including the AWS Elastic Kubernetes Service (EKS). To authenticate
199- against unsupported platforms, you must define a custom callback
200- function to use OIDC to authenticate.
201+ The {+driver-short+} doesn't offer built-in support for all platforms, including
202+ the AWS Elastic Kubernetes Service (EKS). To use OIDC to authenticate against
203+ unsupported platforms, you must define a custom callback function.
201204
202- The following example defines a custom callback for an EKS cluster with a
203- configured Identity and Access Management (IAM) OIDC provider. The access token
204- is read from a path set in the ``AWS_WEB_IDENTITY_TOKEN_FILE`` environment
205- variable. Then, you can set the ``oidc_callback`` field of your ``Credential``
206- struct to ``oidc::Callback::machine``:
205+ First, define a custom callback for an EKS cluster with a configured Identity
206+ and Access Management (IAM) OIDC provider. Then, read the access token from a
207+ path set in the ``AWS_WEB_IDENTITY_TOKEN_FILE`` environment variable. Finally,
208+ set the ``oidc_callback`` field of your ``Credential`` struct to
209+ ``oidc::Callback::machine`` as shown in the following example :
207210
208211.. literalinclude:: /includes/fundamentals/code-snippets/enterprise-auth.rs
209212 :language: rust
@@ -220,8 +223,9 @@ following process:
220223
2212241. The driver retrieves the Identity Provider Information (IDPInfo) for the
222225 provided username.
223- 2. The callback negotiates with the IDP to obtain an ``AccessToken``, possible
224- ``RefreshToken``, and any timeouts, then returns them.
226+ #. The callback negotiates with the IDP to obtain an ``AccessToken``, and any
227+ potential ``RefreshToken`` and timeout values, if configured, then returns
228+ them.
225229
226230The following example defines a custom callback to handle workforce identity.
227231The callback retrieves the IDPInfo for the provided username and negotiates with
0 commit comments