Skip to content

Commit

Permalink
RUST-992 Enable auth tests for PLAIN and fix default authSource for s…
Browse files Browse the repository at this point in the history
…uch (mongodb#451)
  • Loading branch information
abr-egn authored and Andrew Witten committed Sep 9, 2021
1 parent 648ebe3 commit 62431a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/client/auth/mod.rs
Expand Up @@ -205,7 +205,7 @@ impl AuthMechanism {
uri_db.unwrap_or("admin")
}
AuthMechanism::MongoDbX509 => "$external",
AuthMechanism::Plain => "$external",
AuthMechanism::Plain => uri_db.unwrap_or("$external"),
#[cfg(feature = "aws-auth")]
AuthMechanism::MongoDbAws => "$external",
_ => "",
Expand Down Expand Up @@ -336,7 +336,8 @@ pub struct Credential {
pub username: Option<String>,

/// The database used to authenticate. This applies to all mechanisms and defaults to "admin"
/// in SCRAM authentication mechanisms and "$external" for GSSAPI, MONGODB-X509 and PLAIN.
/// in SCRAM authentication mechanisms, "$external" for GSSAPI and MONGODB-X509, and the
/// database name or "$external" for PLAIN.
pub source: Option<String>,

/// The password to authenticate with. This does not apply to all mechanisms.
Expand Down
2 changes: 0 additions & 2 deletions src/test/spec/auth.rs
Expand Up @@ -52,14 +52,12 @@ async fn run_auth_test(test_file: TestFile) {

let skipped_mechanisms = [
"GSSAPI",
"PLAIN",
"MONGODB-CR",
#[cfg(not(feature = "aws-auth"))]
"MONGODB-AWS",
];

// TODO: GSSAPI (RUST-196)
// TODO: PLAIN (RUST-992)
if skipped_mechanisms
.iter()
.any(|mech| test_case.description.contains(mech))
Expand Down

0 comments on commit 62431a7

Please sign in to comment.