Skip to content

Commit 6a6b556

Browse files
committed
fix: Add credential token to the X-Amz-Security-Token query param if specified
1 parent a88126b commit 6a6b556

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

object_store/src/aws/credential.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,12 @@ impl<'a> AwsAuthorizer<'a> {
233233
.append_pair("X-Amz-Expires", &expires_in.as_secs().to_string())
234234
.append_pair("X-Amz-SignedHeaders", "host");
235235

236-
// TODO: For S3, you must include the X-Amz-Security-Token query parameter in the URL if
236+
// For S3, you must include the X-Amz-Security-Token query parameter in the URL if
237237
// using credentials sourced from the STS service.
238+
if let Some(ref token) = self.credential.token {
239+
url.query_pairs_mut()
240+
.append_pair("X-Amz-Security-Token", token);
241+
}
238242

239243
// We don't have a payload; the user is going to send the payload directly themselves.
240244
let digest = UNSIGNED_PAYLOAD;

0 commit comments

Comments
 (0)