Creates a MongoCredential instance with an unspecified mechanism.
Creates a MongoCredential instance with an unspecified mechanism. The client will negotiate the best mechanism based on the version of the server that the client is authenticating to. If the server version is 3.0 or higher, the driver will authenticate using the SCRAM-SHA-1 mechanism. Otherwise, the driver will authenticate using the MONGODB_CR mechanism.
the user name
the database where the user is defined
the user's password
the credential
Creates a MongoCredential instance for the GSSAPI SASL mechanism.
Creates a MongoCredential instance for the GSSAPI SASL mechanism. To override the default service name of mongodb
, add a
mechanism property with the name SERVICE_NAME
. To force canonicalization of the host name prior to authentication, add a
mechanism property with the name CANONICALIZE_HOST_NAME
with the value true
.
the non-null user name
the credential
Creates a MongoCredential instance for the MongoDB Challenge Response protocol.
Creates a MongoCredential instance for the MongoDB Challenge Response protocol. Use this method only if you want to ensure that the driver uses the MONGODB_CR mechanism regardless of whether the server you are connecting to supports a more secure authentication mechanism. Otherwise use the createCredential method to allow the driver to negotiate the best mechanism based on the server version.
the user name
the database where the user is defined
the user's password
the credential
Creates a MongoCredential instance for the MongoDB X.509 protocol.
Creates a MongoCredential instance for the MongoDB X.509 protocol.
the user name
the credential
Creates a MongoCredential instance for the PLAIN SASL mechanism.
Creates a MongoCredential instance for the PLAIN SASL mechanism.
the non-null user name
the source where the user is defined. This can be either $external
or the name of a database.
the non-null user password
the credential
Creates a MongoCredential instance for the SCRAM-SHA-1 SASL mechanism.
Creates a MongoCredential instance for the SCRAM-SHA-1 SASL mechanism. Use this method only if you want to ensure that the driver uses the MONGODB_CR mechanism regardless of whether the server you are connecting to supports a more secure authentication mechanism. Otherwise use the createCredential method to allow the driver to negotiate the best mechanism based on the server version.
the non-null user name
the source where the user is defined.
the non-null user password
the credential
Represents credentials to authenticate to a MongoDB server, as well as the source of the credentials and the authentication mechanism to use.
1.0