Refactoring day1
This commit is contained in:
25
node_modules/mongodb/lib/operations/connect.js
generated
vendored
25
node_modules/mongodb/lib/operations/connect.js
generated
vendored
@@ -33,11 +33,9 @@ const legacyParse = deprecate(
|
||||
|
||||
const AUTH_MECHANISM_INTERNAL_MAP = {
|
||||
DEFAULT: 'default',
|
||||
PLAIN: 'plain',
|
||||
GSSAPI: 'gssapi',
|
||||
'MONGODB-CR': 'mongocr',
|
||||
PLAIN: 'plain',
|
||||
'MONGODB-X509': 'x509',
|
||||
'MONGODB-AWS': 'mongodb-aws',
|
||||
'SCRAM-SHA-1': 'scram-sha-1',
|
||||
'SCRAM-SHA-256': 'scram-sha-256'
|
||||
};
|
||||
@@ -68,13 +66,12 @@ const monitoringEvents = [
|
||||
|
||||
const VALID_AUTH_MECHANISMS = new Set([
|
||||
'DEFAULT',
|
||||
'PLAIN',
|
||||
'GSSAPI',
|
||||
'MONGODB-CR',
|
||||
'PLAIN',
|
||||
'MONGODB-X509',
|
||||
'MONGODB-AWS',
|
||||
'SCRAM-SHA-1',
|
||||
'SCRAM-SHA-256'
|
||||
'SCRAM-SHA-256',
|
||||
'GSSAPI'
|
||||
]);
|
||||
|
||||
const validOptionNames = [
|
||||
@@ -154,8 +151,6 @@ const validOptionNames = [
|
||||
'tlsCertificateKeyFilePassword',
|
||||
'minHeartbeatFrequencyMS',
|
||||
'heartbeatFrequencyMS',
|
||||
'directConnection',
|
||||
'appName',
|
||||
|
||||
// CMAP options
|
||||
'maxPoolSize',
|
||||
@@ -649,7 +644,6 @@ function generateCredentials(client, username, password, options) {
|
||||
// authMechanism
|
||||
const authMechanismRaw = options.authMechanism || 'DEFAULT';
|
||||
const authMechanism = authMechanismRaw.toUpperCase();
|
||||
const mechanismProperties = options.authMechanismProperties;
|
||||
|
||||
if (!VALID_AUTH_MECHANISMS.has(authMechanism)) {
|
||||
throw MongoError.create({
|
||||
@@ -658,9 +652,18 @@ function generateCredentials(client, username, password, options) {
|
||||
});
|
||||
}
|
||||
|
||||
if (authMechanism === 'GSSAPI') {
|
||||
return new MongoCredentials({
|
||||
mechanism: process.platform === 'win32' ? 'sspi' : 'gssapi',
|
||||
mechanismProperties: options,
|
||||
source,
|
||||
username,
|
||||
password
|
||||
});
|
||||
}
|
||||
|
||||
return new MongoCredentials({
|
||||
mechanism: AUTH_MECHANISM_INTERNAL_MAP[authMechanism],
|
||||
mechanismProperties,
|
||||
source,
|
||||
username,
|
||||
password
|
||||
|
||||
Reference in New Issue
Block a user