@@ -136,14 +136,25 @@ async fn authenticate_stream_inner(
136
136
) ;
137
137
138
138
let date = Utc :: now ( ) ;
139
- // Generate authorization header using original implementation without AWS SDK
140
139
140
+ // Generate authorization header using original implementation without AWS SDK
141
141
// let authorization_header = aws_credential.compute_authorization_header(
142
142
// date,
143
143
// &server_first.sts_host,
144
144
// &server_first.server_nonce,
145
145
// )?;
146
146
147
+ // dbg!("authorization header: {}", &authorization_header);
148
+
149
+ // let mut client_second_payload = doc! {
150
+ // "a": authorization_header,
151
+ // "d": date.format(AWS_LONG_DATE_FMT).to_string(),
152
+ // };
153
+
154
+ // if let Some(security_token) = aws_credential.session_token {
155
+ // client_second_payload.insert("t", security_token);
156
+ // }
157
+
147
158
let sigv4_headers = compute_aws_sigv4_headers (
148
159
creds,
149
160
date,
@@ -243,9 +254,9 @@ pub async fn compute_aws_sigv4_headers(
243
254
} ;
244
255
245
256
let url = format ! ( "https://{}" , host) ;
246
- let service = "execute-api " ;
257
+ let service = "sts " ;
247
258
let body_str = "Action=GetCallerIdentity&Version=2011-06-15" ;
248
- // let body_bytes = body_str.as_bytes();
259
+ let body_bytes = body_str. as_bytes ( ) ;
249
260
let nonce_b64 = base64:: encode ( server_nonce) ;
250
261
251
262
// Create the HTTP request
@@ -254,7 +265,7 @@ pub async fn compute_aws_sigv4_headers(
254
265
. uri ( & url)
255
266
. header ( "host" , host)
256
267
. header ( "content-type" , "application/x-www-form-urlencoded" )
257
- // .header("content-length", body_bytes.len())
268
+ . header ( "content-length" , body_bytes. len ( ) )
258
269
. header ( "x-amz-date" , date_str. clone ( ) )
259
270
. header ( "x-mongodb-gs2-cb-flag" , "n" )
260
271
. header ( "x-mongodb-server-nonce" , nonce_b64. clone ( ) ) ;
0 commit comments