File tree 2 files changed +12
-7
lines changed
2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,12 @@ import { MongoCredentials } from './cmap/auth/mongo_credentials';
8
8
import { AUTH_MECHS_AUTH_SRC_EXTERNAL , AuthMechanism } from './cmap/auth/providers' ;
9
9
import { Compressor , CompressorName } from './cmap/wire_protocol/compression' ;
10
10
import { Encrypter } from './encrypter' ;
11
- import { MongoAPIError , MongoInvalidArgumentError , MongoParseError } from './error' ;
11
+ import {
12
+ MongoAPIError ,
13
+ MongoInvalidArgumentError ,
14
+ MongoMissingCredentialsError ,
15
+ MongoParseError
16
+ } from './error' ;
12
17
import { Logger , LoggerLevel } from './logger' ;
13
18
import {
14
19
DriverInfo ,
@@ -407,6 +412,12 @@ export function parseOptions(
407
412
} ) ;
408
413
}
409
414
415
+ if ( isAws && mongoOptions . credentials . username && ! mongoOptions . credentials . password ) {
416
+ throw new MongoMissingCredentialsError (
417
+ `When using ${ mongoOptions . credentials . mechanism } password must be set when a username is specified`
418
+ ) ;
419
+ }
420
+
410
421
mongoOptions . credentials . validate ( ) ;
411
422
412
423
// Check if the only auth related option provided was authSource, if so we can remove credentials
Original file line number Diff line number Diff line change 1
1
import { loadSpecTests } from '../../spec' ;
2
2
import { executeUriValidationTest } from '../../tools/uri_spec_runner' ;
3
3
4
- const SKIP = [ 'should throw an exception if username and no password (MONGODB-AWS)' ] ;
5
-
6
4
describe ( 'Auth option spec tests' , function ( ) {
7
5
const suites = loadSpecTests ( 'auth' ) ;
8
6
9
7
for ( const suite of suites ) {
10
8
describe ( suite . name , function ( ) {
11
9
for ( const test of suite . tests ) {
12
10
it ( `${ test . description } ` , function ( ) {
13
- if ( SKIP . includes ( test . description ) ) {
14
- this . test . skipReason = 'NODE-3986: Fix MONGODB-AWS Spec Test' ;
15
- this . skip ( ) ;
16
- }
17
11
executeUriValidationTest ( test ) ;
18
12
} ) ;
19
13
}
You can’t perform that action at this time.
0 commit comments