diff options
author | Cheahuychou Mao <mao.cheahuychou@gmail.com> | 2021-01-29 15:36:29 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-02 10:02:35 +0000 |
commit | 8baad6fdb799b24bbc999089773698a10bfeaecc (patch) | |
tree | 0bb2f389723bcd8434ece650fffb050b1dbed8f1 /src/mongo/db/commands/tenant_migration_donor_cmds.cpp | |
parent | 739d938be8bb992190b01004f39eecc2658c5c38 (diff) | |
download | mongo-8baad6fdb799b24bbc999089773698a10bfeaecc.tar.gz |
SERVER-54084 Add server parameter tenantMigrationDisableX509Auth to enable keyfile auth testing
Diffstat (limited to 'src/mongo/db/commands/tenant_migration_donor_cmds.cpp')
-rw-r--r-- | src/mongo/db/commands/tenant_migration_donor_cmds.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/mongo/db/commands/tenant_migration_donor_cmds.cpp b/src/mongo/db/commands/tenant_migration_donor_cmds.cpp index add2ef18e6a..1570f370213 100644 --- a/src/mongo/db/commands/tenant_migration_donor_cmds.cpp +++ b/src/mongo/db/commands/tenant_migration_donor_cmds.cpp @@ -64,13 +64,24 @@ public: const auto& cmd = request(); - const TenantMigrationDonorDocument stateDoc( - cmd.getMigrationId(), - cmd.getRecipientConnectionString().toString(), - cmd.getReadPreference(), - cmd.getTenantId().toString(), - cmd.getDonorCertificateForRecipient(), - cmd.getRecipientCertificateForDonor()); + TenantMigrationDonorDocument stateDoc(cmd.getMigrationId(), + cmd.getRecipientConnectionString().toString(), + cmd.getReadPreference(), + cmd.getTenantId().toString()); + + if (!repl::tenantMigrationDisableX509Auth) { + uassert(ErrorCodes::InvalidOptions, + str::stream() << "'" << Request::kDonorCertificateForRecipientFieldName + << "' is a required field", + cmd.getDonorCertificateForRecipient()); + uassert(ErrorCodes::InvalidOptions, + str::stream() << "'" << Request::kRecipientCertificateForDonorFieldName + << "' is a required field", + cmd.getRecipientCertificateForDonor()); + stateDoc.setDonorCertificateForRecipient(cmd.getDonorCertificateForRecipient()); + stateDoc.setRecipientCertificateForDonor(cmd.getRecipientCertificateForDonor()); + } + const auto stateDocBson = stateDoc.toBSON(); auto donorService = |