Skip to content

RUST-992 Enable auth tests for PLAIN and fix default authSource for such #451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/client/auth/mod.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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