This repository has been archived by the owner on Feb 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(auth): adds saslprep and SCRAM-SHA-256
- Adds SCRAM-SHA-256 and SASLPrep support to auth. - Throws an error if the iteration count in response to SASLStart is less than 4096. - Implements Mechanism Negotiations for default authentication method - Properly propagates server errors back to the user Fixes NODE-1311
- Loading branch information
1 parent
b0a3abb
commit 506c087
Showing
10 changed files
with
342 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
const MongoCR = require('./mongocr'); | ||
const X509 = require('./x509'); | ||
const Plain = require('./plain'); | ||
const GSSAPI = require('./gssapi'); | ||
const SSPI = require('./sspi'); | ||
const ScramSHA1 = require('./scram').ScramSHA1; | ||
const ScramSHA256 = require('./scram').ScramSHA256; | ||
|
||
/** | ||
* Returns the default authentication providers. | ||
* | ||
* @param {BSON} bson Bson definition | ||
* @returns {Object} a mapping of auth names to auth types | ||
*/ | ||
function defaultAuthProviders(bson) { | ||
return { | ||
mongocr: new MongoCR(bson), | ||
x509: new X509(bson), | ||
plain: new Plain(bson), | ||
gssapi: new GSSAPI(bson), | ||
sspi: new SSPI(bson), | ||
'scram-sha-1': new ScramSHA1(bson), | ||
'scram-sha-256': new ScramSHA256(bson) | ||
}; | ||
} | ||
|
||
module.exports = { defaultAuthProviders }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.