Skip to content
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

Add test for overriding S3 Express credentials provider #3459

Merged
Merged
Changes from 1 commit
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
33 changes: 32 additions & 1 deletion aws/sdk/integration-tests/s3/tests/express.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use std::time::{Duration, SystemTime};

use aws_config::Region;
use aws_sdk_s3::config::Builder;
use aws_sdk_s3::config::{Builder, Credentials};
use aws_sdk_s3::presigning::PresigningConfig;
use aws_sdk_s3::primitives::SdkBody;
use aws_sdk_s3::types::ChecksumAlgorithm;
Expand Down Expand Up @@ -353,3 +353,34 @@ async fn disable_s3_express_session_auth_at_operation_level() {
"x-amz-create-session-mode should not appear in headers when S3 Express session auth is disabled"
);
}

#[tokio::test]
async fn support_customer_overriding_express_credentials_provider() {
let (http_client, rx) = capture_request(None);
let expected_session_token = "testsessiontoken";
let client = test_client(|b| {
b.http_client(http_client.clone())
// Pass a credential with a session token so that
// `x-amz-s3session-token` should appear in the request header.
.express_credentials_provider(Credentials::new(
"testaccess",
"testsecret",
Some(expected_session_token.to_owned()),
None,
"test",
))
})
.await;
let _ = client
.list_objects_v2()
.bucket("s3express-test-bucket--usw2-az1--x-s3")
.send()
.await;

let req = rx.expect_request();
let actual_session_token = req
.headers()
.get("x-amz-s3session-token")
.expect("x-amz-s3session-token should be present");
assert_eq!(expected_session_token, actual_session_token);
ysaito1001 marked this conversation as resolved.
Show resolved Hide resolved
}
Loading