Skip to content

Commit 007894c

Browse files
RUST-1529 Remove manual AWS authentication implementation (#1450)
1 parent ac0f721 commit 007894c

File tree

7 files changed

+22
-622
lines changed

7 files changed

+22
-622
lines changed

.evergreen/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ buildvariants:
223223

224224
- name: aws-auth
225225
display_name: "AWS Authentication"
226-
patchable: false
226+
# patchable: false
227227
run_on:
228228
- ubuntu2004-small
229229
expansions:

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ dns-resolver = ["dep:hickory-resolver", "dep:hickory-proto"]
4141
cert-key-password = ["dep:pem", "dep:pkcs8"]
4242

4343
# Enable support for MONGODB-AWS authentication.
44-
aws-auth = ["dep:reqwest", "dep:aws-config", "dep:aws-types", "dep:aws-credential-types", "dep:aws-sigv4", "dep:http"]
44+
aws-auth = ["dep:aws-config", "dep:aws-types", "dep:aws-credential-types", "dep:aws-sigv4", "dep:http"]
4545

4646
# Enable support for on-demand Azure KMS credentials.
4747
azure-kms = ["dep:reqwest"]

src/client/auth.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,15 @@ pub enum AuthMechanism {
8686
/// Assume Role request, or temporary AWS IAM credentials assigned to an EC2 instance or ECS
8787
/// task.
8888
///
89-
/// Note: Only server versions 4.4+ support AWS authentication. Additionally, the driver only
90-
/// supports AWS authentication with the tokio runtime.
89+
/// The driver uses the [AWS SDK](https://github.com/awslabs/aws-sdk-rust) to retrieve AWS
90+
/// credentials. If you have a shared AWS credentials or config file, then those credentials
91+
/// will be used by default if AWS authentication environment variables are not set. To
92+
/// override this behavior, set `AWS_SHARED_CREDENTIALS_FILE=""` in your shell or set the
93+
/// equivalent environment variable value in your script or application. Alternatively, you
94+
/// can create an AWS profile specifically for your MongoDB credentials and set the
95+
/// `AWS_PROFILE` environment variable to that profile name.
96+
///
97+
/// Note: Only server versions 4.4+ support AWS authentication.
9198
#[cfg(feature = "aws-auth")]
9299
MongoDbAws,
93100

@@ -320,7 +327,7 @@ impl AuthMechanism {
320327
}
321328
#[cfg(feature = "aws-auth")]
322329
AuthMechanism::MongoDbAws => {
323-
aws::authenticate_stream(stream, credential, server_api, &opts.http_client).await
330+
aws::authenticate_stream(stream, credential, server_api).await
324331
}
325332
AuthMechanism::MongoDbCr => Err(ErrorKind::Authentication {
326333
message: "MONGODB-CR is deprecated and not supported by this driver. Use SCRAM \
@@ -414,8 +421,6 @@ impl FromStr for AuthMechanism {
414421
// Auxiliary information needed by authentication mechanisms.
415422
pub(crate) struct AuthOptions {
416423
server_api: Option<ServerApi>,
417-
#[cfg(feature = "aws-auth")]
418-
http_client: crate::runtime::HttpClient,
419424
#[cfg(feature = "gssapi-auth")]
420425
resolver_config: Option<ResolverConfig>,
421426
}
@@ -424,8 +429,6 @@ impl From<&ClientOptions> for AuthOptions {
424429
fn from(opts: &ClientOptions) -> Self {
425430
Self {
426431
server_api: opts.server_api.clone(),
427-
#[cfg(feature = "aws-auth")]
428-
http_client: crate::runtime::HttpClient::default(),
429432
#[cfg(feature = "gssapi-auth")]
430433
resolver_config: opts.resolver_config.clone(),
431434
}

0 commit comments

Comments
 (0)