Skip to content

Commit 9eff930

Browse files
committed
DOCSP-47923 Kubernetes for OIDC
1 parent 52989b6 commit 9eff930

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

source/security/enterprise-auth.txt

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Enterprise Edition:
3030
- :ref:`Kerberos (GSSAPI) <gssapi-auth-mechanism>`
3131
- :ref:`LDAP (PLAIN) <plain-auth-mechanism>`
3232
- :ref:`MONGODB-OIDC <mongodb-oidc>`
33+
- :ref:`Kubernetes <java-sync-kubernetes>`
3334

3435
To authenticate using another mechanism, see the
3536
:doc:`Authentication Mechanisms guide </fundamentals/auth>`. For more
@@ -47,7 +48,7 @@ Mechanisms
4748
.. _gssapi-auth-mechanism:
4849

4950
Kerberos (GSSAPI)
50-
~~~~~~~~~~~~~~~~~~~~~~
51+
~~~~~~~~~~~~~~~~~
5152

5253
The Generic Security Services API (``GSSAPI``) authentication mechanism
5354
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:
460461
builder.hosts(Arrays.asList(new ServerAddress("<hostname>", <port>))))
461462
.credential(credential)
462463
.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

Comments
 (0)