SCRAM

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)身份验证机制的支持。

If your deployment has user credentials stored in MONGODB-CR schema, you must upgrade to SCRAM before you upgrade to version 4.0.如果部署的用户凭据存储在MongoDB-CR架构中,则必须先升级到SCRAM,然后才能升级到版本4.0。For information on upgrading to SCRAM, see Upgrade to SCRAM.有关升级到SCRAM的信息,请参阅升级到SCRAM

Salted Challenge Response Authentication Mechanism (SCRAM) is the default authentication mechanism for MongoDB.Salted Challenge-Response认证机制(SCRAM)是MongoDB的默认认证机制。SCRAM is based on the IETF RFC 5802 standard that defines best practices for implementation of challenge-response mechanisms for authenticating users with passwords.SCRAM基于IETF RFC 5802标准,该标准定义了用密码验证用户的质询-响应机制实现的最佳实践。

Using SCRAM, MongoDB verifies the supplied user credentials against the user’s name, password and authentication database.使用SCRAM,MongoDB根据namepasswordauthentication database验证提供的用户凭据。The authentication database is the database where the user was created, and together with the user’s name, serves to identify the user.身份验证数据库是创建用户的数据库,与用户名一起用于标识用户。

Features特征

MongoDB’s implementation of SCRAM provides:MongoDB实施SCRAM提供:

SCRAM Mechanisms机制

MongoDB supports the following SCRAM mechanisms:MongoDB支持以下紧急停堆机制:

SCRAM MechanismSCRAM机制Description说明
SCRAM-SHA-1

Uses the SHA-1 hashing function.使用SHA-1哈希函数。

To modify the iteration count for SCRAM-SHA-1, see scramIterationCount.要修改SCRAM-SHA-1的迭代计数,请参阅scramIterationCount

SCRAM-SHA-256

Uses the SHA-256 hashing function and requires featureCompatibilityVersion (fcv) set to 4.0.使用SHA-256哈希函数,需要将featureCompatibilityVersion(fcv)设置为4.0

To modify the iteration count for SCRAM-SHA-256, see scramSHA256IterationCount.要修改SCRAM-SHA-256的迭代计数,请参阅scramSHA256IterationCount

New in version 4.0.版本4.0中的新增功能。

When creating or updating a SCRAM user, you can indicate the specific SCRAM mechanism as well as indicate whether the server or the client digests the password.创建或更新紧急停堆用户时,您可以指示特定的紧急停堆机制,以及指示服务器或客户端是否消化密码。When using SCRAM-SHA-256, MongoDB requires server-side password hashing, i.e. the server digests the password.当使用SCRAM-SHA-256时,MongoDB需要服务器端密码散列,即服务器对密码进行消化。For details, see db.createUser() and db.updateUser().有关详细信息,请参阅db.updateUser()db.updateUser()

Driver Support驱动程序支持

To use SCRAM, you must upgrade your driver if your current driver version does not support SCRAM.要使用SCRAM,如果当前驱动程序版本不支持SCRAM,则必须升级驱动程序。

The minimum driver versions that support SCRAM are:支持SCRAM的最低驱动程序版本为:

Driver LanguageVersionDriver LanguageVersion
C 1.1.0 Perl 1.0.0
C++ 1.0.0 PHP 1.0
C# 1.10 Python 2.8
Java 2.13 Motor 0.4
Node.js 1.4.29 Ruby 1.12
    Scala 2.8.0

Additional Information附加信息