Skip to content

Commit 334ca9c

Browse files
committed
fix(auth-process): only send username/password if provided
NODE-1479
1 parent c031a3b commit 334ca9c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/auth_processes/mongodb.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ class MongoAuthProcess {
5353
performGssapiCanonicalizeHostName(this.canonicalizeHostName, this.host, err => {
5454
if (err) return callback(err);
5555

56-
kerberos.initializeClient(self.service, { user: username, password }, (err, client) => {
56+
const initOptions = {};
57+
if (password != null) {
58+
Object.assign(initOptions, { user: username, password });
59+
}
60+
61+
kerberos.initializeClient(self.service, initOptions, (err, client) => {
5762
if (err) return callback(err, null);
5863

5964
self.client = client;

0 commit comments

Comments
 (0)