Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/connection_string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@ export function parseOptions(
});
}

if (isAws && mongoOptions.credentials.username && !mongoOptions.credentials.password) {
throw new MongoParseError(
`${mongoOptions.credentials.mechanism} must receive a password when a username is specified`
);
}

mongoOptions.credentials.validate();

// Check if the only auth related option provided was authSource, if so we can remove credentials
Expand Down
6 changes: 0 additions & 6 deletions test/unit/assorted/auth.spec.test.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import { loadSpecTests } from '../../spec';
import { executeUriValidationTest } from '../../tools/uri_spec_runner';

const SKIP = ['should throw an exception if username and no password (MONGODB-AWS)'];

describe('Auth option spec tests', function () {
const suites = loadSpecTests('auth');

for (const suite of suites) {
describe(suite.name, function () {
for (const test of suite.tests) {
it(`${test.description}`, function () {
if (SKIP.includes(test.description)) {
this.test.skipReason = 'NODE-3986: Fix MONGODB-AWS Spec Test';
this.skip();
}
executeUriValidationTest(test);
});
}
Expand Down