A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.mongodb.com/docs/languages/python/pymongo-driver/current/security/authentication/x509/ below:

X.509 - PyMongo Driver v4.13

In the X.509 authentication mechanism, the server and client use the TLS protocol to exchange X.509 public-key certificates. You can use this mechanism to authenticate to MongoDB Atlas, MongoDB Enterprise Advanced, and MongoDB Community Edition.

Tip X.509 Mechanism

To learn how to use TLS/SSL with the PyMongo, see TLS/SSL.

For more information about X.509 certificates, see X.509 in the MongoDB Server manual.

The code examples on this page use the following placeholders:

To use the code examples on this page, replace these placeholders with your own values.

Important Percent-Encoding

You must percent-encode a username and password before you include them in a MongoDB URI. The quote_plus() method, available in the urllib.parse module, is one way to perform this task. For example, calling quote_plus("and / or") returns the string and+%2F+or.

Don't percent-encode the username or password when passing them as arguments to MongoClient.

You can set these options in two ways: by passing arguments to the MongoClient constructor or through parameters in your connection string.

client = pymongo.MongoClient("mongodb[+srv]://<hostname>:<port>",                             tls=True,                             tlsCertificateKeyFile="<path to X.509 certificate>",                             tlsCertificateKeyFilePassword="<X.509 certificate password>",                             authMechanism="MONGODB-X509")
uri = ("mongodb[+srv]://<hostname>:<port>/?"       "tls=true"       "&tlsCertificateKeyFile=<path to X.509 certificate>"       "&tlsCertificateKeyFilePassword=<X.509 certificate password>"       "&authMechanism=MONGODB-X509")client = pymongo.MongoClient(uri)
client = pymongo.AsyncMongoClient("mongodb[+srv]://<hostname>:<port>",                                  tls=True,                                  tlsCertificateKeyFile="<path to X.509 certificate>",                                  tlsCertificateKeyFilePassword="<X.509 certificate password>",                                  authMechanism="MONGODB-X509")
uri = ("mongodb[+srv]://<hostname>:<port>/?"       "tls=true"       "&tlsCertificateKeyFile=<path to X.509 certificate>"       "&tlsCertificateKeyFilePassword=<X.509 certificate password>"       "&authMechanism=MONGODB-X509")client = pymongo.AsyncMongoClient(uri)

To learn more about authenticating your application in PyMongo, see the following API documentation:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4