mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-35487 Remove FCV 4.0 checks from user management
This commit is contained in:
parent
620d5006e0
commit
22399669bb
@ -22,18 +22,6 @@
|
||||
assert.commandFailedWithCode(db.runCommand({isMaster: 1, saslSupportedMechs: "bogus"}),
|
||||
ErrorCodes.BadValue);
|
||||
|
||||
// Create a legacy user.
|
||||
assert.commandWorked(db.adminCommand({setFeatureCompatibilityVersion: "3.6"}));
|
||||
assert.commandWorked(db.runCommand({createUser: "legacyUser", pwd: "pwd", roles: []}));
|
||||
checkMechs("admin.legacyUser", ["SCRAM-SHA-1"]);
|
||||
|
||||
// Enable SCRAM-SHA-256.
|
||||
assert.commandWorked(db.adminCommand({setFeatureCompatibilityVersion: "4.0"}));
|
||||
|
||||
// Legacy users continue expressing SCRAM-SHA-1
|
||||
checkMechs("admin.legacyUser", ["SCRAM-SHA-1"]);
|
||||
|
||||
// Make users.
|
||||
assert.commandWorked(db.runCommand({createUser: "user", pwd: "pwd", roles: []}));
|
||||
assert.commandWorked(externalDB.runCommand({createUser: "user", roles: []}));
|
||||
|
||||
|
@ -73,23 +73,6 @@
|
||||
admin.createUser({user: 'admin', pwd: 'pass', roles: jsTest.adminUserRoles});
|
||||
assert(admin.auth('admin', 'pass'));
|
||||
|
||||
// Test FCV 3.6 mode first.
|
||||
assert.commandWorked(admin.runCommand({setFeatureCompatibilityVersion: "3.6"}));
|
||||
|
||||
// By default, only create SHA-1 in 3.6 FCV mode.
|
||||
test.createUser({user: 'sha1default', pwd: 'pass', roles: jsTest.basicUserRoles});
|
||||
checkUser('sha1default', 'pass', true, false);
|
||||
|
||||
// SCRAM-SHA-256 not available.
|
||||
assert.throws(function() {
|
||||
test.createUser({
|
||||
user: 'sha256failure',
|
||||
pwd: 'pass',
|
||||
roles: jsTest.basicUserRoles,
|
||||
mechanisms: ['SCRAM-SHA-256']
|
||||
});
|
||||
});
|
||||
|
||||
// Unknown mechanism.
|
||||
assert.throws(function() {
|
||||
test.createUser({
|
||||
@ -100,9 +83,6 @@
|
||||
});
|
||||
});
|
||||
|
||||
// Now do general testing with SCRAM-SHA-256 enabled.
|
||||
assert.commandWorked(admin.runCommand({setFeatureCompatibilityVersion: "4.0"}));
|
||||
|
||||
// By default, users are created with both SCRAM variants.
|
||||
test.createUser({user: 'user', pwd: 'pass', roles: jsTest.basicUserRoles});
|
||||
checkUser('user', 'pass', true, true);
|
||||
@ -212,7 +192,7 @@
|
||||
allSCRAMSHA1UsersInfo.users.forEach(function(userObj) {
|
||||
foundUsers.push(userObj.user);
|
||||
});
|
||||
assert.eq(["sha1default", "sha1user", "sha1user2", "\u2168"], foundUsers);
|
||||
assert.eq(["sha1user", "sha1user2", "\u2168"], foundUsers);
|
||||
|
||||
// Demonstrate that usersInfo can find SCRAM-SHA-256 users
|
||||
const allSCRAMSHA256UsersInfo = assert.commandWorked(
|
||||
|
@ -665,15 +665,6 @@ Status buildCredentials(BSONObjBuilder* builder, const auth::CreateOrUpdateUserA
|
||||
builder->append("SCRAM-SHA-1", sha1Cred);
|
||||
}
|
||||
|
||||
if (buildSCRAMSHA256) {
|
||||
// FCV check is deferred till this point so that the suitability checks can be performed
|
||||
// regardless.
|
||||
const auto fcv = serverGlobalParams.featureCompatibility.getVersion();
|
||||
if (fcv < ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40) {
|
||||
buildSCRAMSHA256 = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (buildSCRAMSHA256) {
|
||||
if (!args.digestPassword) {
|
||||
return {ErrorCodes::BadValue, "Use of SCRAM-SHA-256 requires undigested passwords"};
|
||||
|
Loading…
Reference in New Issue
Block a user