Skip to content

Commit

Permalink
Remove use of _usesRoles helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcollier committed Dec 12, 2023
1 parent 130faaa commit 8b5cf80
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions lib/authn.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ export async function openDatabase(options) {
const serverInfo = await admin.serverInfo(null);
_checkServerVersion({serverInfo, config});

// check if server supports roles; if not, can't authenticate
if(!_usesRoles(serverInfo)) {
const stringVersion = serverInfo.versionArray.join('.');
throw new BedrockError(
`MongoDB server version "${stringVersion}" is unsupported.`,
'NotSupportedError');
}
// makes an unauthenticated call to the server
// to see if auth is required
const authRequired = await _isAuthnRequired({config, admin});
Expand Down Expand Up @@ -88,13 +81,6 @@ async function _connect(options) {
return {client, db};
}

function _usesRoles(serverInfo) {
// >= Mongo 2.6 uses user roles
return (
(serverInfo.versionArray[0] == 2 && serverInfo.versionArray[1] >= 6) ||
(serverInfo.versionArray[0] > 2));
}

/**
* Determines if authn is required.
*
Expand Down

0 comments on commit 8b5cf80

Please sign in to comment.