Skip to content

Commit c64a610

Browse files
committed
Move aws sdk credential getting logic after original commented impl
1 parent f2a4a62 commit c64a610

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/client/auth/aws.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,6 @@ async fn authenticate_stream_inner(
9797
let server_first = ServerFirst::parse(server_first_response.auth_response_body(MECH_NAME)?)?;
9898
server_first.validate(&nonce)?;
9999

100-
let creds = get_aws_credentials(credential).await.map_err(|e| {
101-
Error::authentication_error(MECH_NAME, &format!("failed to get creds: {e}"))
102-
})?;
103-
let aws_credential = AwsCredential::from_sdk_creds(
104-
creds.access_key_id().to_string(),
105-
creds.secret_access_key().to_string(),
106-
creds.session_token().map(|s| s.to_string()),
107-
None,
108-
);
109-
110100
// Find credentials using original implementation without AWS SDK
111101
// let aws_credential = {
112102
// // Limit scope of this variable to avoid holding onto the lock for the duration of
@@ -126,6 +116,16 @@ async fn authenticate_stream_inner(
126116
// }
127117
// };
128118

119+
let creds = get_aws_credentials(credential).await.map_err(|e| {
120+
Error::authentication_error(MECH_NAME, &format!("failed to get creds: {e}"))
121+
})?;
122+
let aws_credential = AwsCredential::from_sdk_creds(
123+
creds.access_key_id().to_string(),
124+
creds.secret_access_key().to_string(),
125+
creds.session_token().map(|s| s.to_string()),
126+
None,
127+
);
128+
129129
let date = Utc::now();
130130

131131
let authorization_header = aws_credential.compute_authorization_header(

0 commit comments

Comments
 (0)