Authentication Mechanisms身份验证机制

On this page本页内容

Note

Starting in version 4.0, MongoDB removes support for the deprecated MongoDB Challenge-Response (MONGODB-CR) authentication mechanism.从版本4.0开始,MongoDB取消了对不推荐使用的MongoDB质询响应(MongoDB-CR)身份验证机制的支持。

MongoDB supports the following authentication mechanisms:MongoDB支持以下身份验证机制:

In addition, MongoDB Enterprise provides integration with a number of external authentication mechanisms, including Kerberos and LDAP.此外,MongoDB enterprise还提供了与许多外部身份验证机制的集成,包括Kerberos和LDAP。See Enterprise Authentication Mechanisms for the additional authentication mechanisms supported by MongoDB Enterprise.有关MongoDB企业版支持的其他身份验证机制,请参阅企业身份验证机制

Default Authentication Mechanism默认身份验证机制

As of MongoDB 3.0, Salted Challenge Response Authentication Mechanism (SCRAM) is the default authentication mechanism for MongoDB.从MongoDB 3.0开始,咸质询-响应身份验证机制(SCRAM)是MongoDB的默认身份验证机制。

Specify Authentication Mechanism指定身份验证机制

To specify the authentication mechanism to use, set the authenticationMechanisms parameter for mongod and mongos.要指定要使用的身份验证机制,请为mongodmongos设置authenticationMechanisms参数。

Clients specify the authentication mechanism in the db.auth() method.客户端在db.auth()方法中指定身份验证机制。For the mongo shell and the MongoDB tools, you can also specify the authentication mechanism from the command line.对于mongoshell和MongoDB工具,还可以从命令行指定身份验证机制。