@@ -30,6 +30,7 @@ Enterprise Edition:
30
30
- :ref:`Kerberos (GSSAPI) <gssapi-auth-mechanism>`
31
31
- :ref:`LDAP (PLAIN) <plain-auth-mechanism>`
32
32
- :ref:`MONGODB-OIDC <mongodb-oidc>`
33
+ - :ref:`Kubernetes <java-sync-kubernetes>`
33
34
34
35
To authenticate using another mechanism, see the
35
36
:doc:`Authentication Mechanisms guide </fundamentals/auth>`. For more
@@ -47,7 +48,7 @@ Mechanisms
47
48
.. _gssapi-auth-mechanism:
48
49
49
50
Kerberos (GSSAPI)
50
- ~~~~~~~~~~~~~~~~~~~~~~
51
+ ~~~~~~~~~~~~~~~~~
51
52
52
53
The Generic Security Services API (``GSSAPI``) authentication mechanism
53
54
allows the user to authenticate to a Kerberos service using the user's
@@ -460,3 +461,25 @@ named ``"access-token.dat"`` in the local file system:
460
461
builder.hosts(Arrays.asList(new ServerAddress("<hostname>", <port>))))
461
462
.credential(credential)
462
463
.build());
464
+
465
+ .. _java-sync-kubernetes:
466
+
467
+ Kubernetes
468
+ ~~~~~~~~~~
469
+
470
+ If your application runs on a Kubernetes cluster, you can authenticate to MongoDB by using
471
+ the {+driver-short+}'s built-in Kubernetes support.
472
+
473
+ To specify Kubernetes OIDC as the authentication mechanism, set the following
474
+ options in your connection string:
475
+
476
+ - ``authMechanism``: Set to ``MONGODB-OIDC``.
477
+ - ``authMechanismProperties``: Set to ``ENVIRONMENT:k8s``.
478
+
479
+ The following code example shows how to set the preceding connection options:
480
+
481
+ .. code-block:: java
482
+
483
+ String uri = "mongodb://<hostname>:<port>/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:k8s";
484
+ MongoClient mongoClient = MongoClients.create(uri)
485
+
0 commit comments