Skip to content

Commit 24667c2

Browse files
committed
MD tech review 1
1 parent 4f88941 commit 24667c2

File tree

3 files changed

+10
-42
lines changed

3 files changed

+10
-42
lines changed

source/fundamentals/enterprise-auth.txt

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -409,27 +409,16 @@ environment variable:
409409
:start-after: start-custom-callback
410410
:end-before: end-custom-callback
411411

412-
Next, create a map to store your authentication
413-
mechanism properties, as shown in the following example. Replace
414-
the ``<audience>`` placeholder with the value of the ``audience``
415-
parameter configured on your MongoDB deployment.
416-
417-
.. code-block:: go
418-
419-
props := map[string]string{
420-
"TOKEN_RESOURCE": "<audience>",
421-
}
422-
423-
Then, you can create a ``Credential`` struct that uses the properties
424-
map and the EKS callback function:
412+
Then, you can create a ``Credential`` struct that uses the EKS callback
413+
function that you defined:
425414

426415
.. literalinclude:: /includes/authentication/eks-custom-callback.go
427416
:language: go
428417
:dedent:
429418
:copyable: true
430419
:start-after: start-credential-callback
431420
:end-before: end-credential-callback
432-
:emphasize-lines: 10
421+
:emphasize-lines: 6
433422

434423
.. _golang-mongodb-oidc-azure-envs:
435424

@@ -478,28 +467,16 @@ service-account token-file location:
478467
:start-after: start-callback
479468
:end-before: end-callback
480469

481-
Next, create a map to store your authentication
482-
mechanism properties, as shown in the following example. Replace
483-
the ``<audience>`` placeholder with the value of the ``audience``
484-
parameter configured on your MongoDB deployment.
485-
486-
.. code-block:: go
487-
488-
props := map[string]string{
489-
"ENVIRONMENT": "gcp",
490-
"TOKEN_RESOURCE": "<audience>",
491-
}
492-
493-
Then, you can create a ``Credential`` struct that uses the properties
494-
map and the GKE callback function:
470+
Then, you can create a ``Credential`` struct that uses the the GKE
471+
callback function that you defined:
495472

496473
.. literalinclude:: /includes/authentication/gke-callback.go
497474
:language: go
498475
:copyable: true
499476
:dedent:
500477
:start-after: start-credential-callback
501478
:end-before: end-credential-callback
502-
:emphasize-lines: 11
479+
:emphasize-lines: 6
503480

504481
Additional Information
505482
----------------------

source/includes/authentication/eks-custom-callback.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,11 @@ func main() {
2525

2626
// start-credential-callback
2727
uri := "mongodb://<hostname>:<port>"
28-
props := map[string]string{
29-
"TOKEN_RESOURCE": "<audience>",
30-
}
3128
opts := options.Client().ApplyURI(uri)
3229
opts.SetAuth(
3330
options.Credential{
34-
AuthMechanism: "MONGODB-OIDC",
35-
AuthMechanismProperties: props,
36-
OIDCMachineCallback: eksCallback,
31+
AuthMechanism: "MONGODB-OIDC",
32+
OIDCMachineCallback: eksCallback,
3733
},
3834
)
3935
client, err := mongo.Connect(opts)

source/includes/authentication/gke-callback.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,11 @@ func main() {
2525

2626
// start-credential-callback
2727
uri := "mongodb://<hostname>:<port>"
28-
props := map[string]string{
29-
"ENVIRONMENT": "gcp",
30-
"TOKEN_RESOURCE": "<audience>",
31-
}
3228
opts := options.Client().ApplyURI(uri)
3329
opts.SetAuth(
3430
options.Credential{
35-
AuthMechanism: "MONGODB-OIDC",
36-
AuthMechanismProperties: props,
37-
OIDCMachineCallback: gkeCallback,
31+
AuthMechanism: "MONGODB-OIDC",
32+
OIDCMachineCallback: gkeCallback,
3833
},
3934
)
4035
client, err := mongo.Connect(opts)

0 commit comments

Comments
 (0)