예제 #1
0
        public async Task <CallerIdentityVerificationParameters> GetCallerIdentityVerificationParametersAsync()
        {
            var httpRequest = new HttpRequestMessage(HttpMethod.Post, Endpoint)
            {
                Content = GetPostContent(StsRequestHelper.ToParams(GetCallerIdentityRequest.Default))
            };

            await SignAsync(httpRequest);

            var headers = new Dictionary <string, string>();

            foreach (var header in httpRequest.Headers)
            {
                if (header.Key.StartsWith("x-amz-", StringComparison.Ordinal) || header.Key == "Authorization")
                {
                    headers.Add(header.Key, string.Join(";", header.Value));
                }
            }

            return(new CallerIdentityVerificationParameters(
                       url: httpRequest.RequestUri.ToString(),
                       headers: headers,
                       body: await httpRequest.Content.ReadAsStringAsync().ConfigureAwait(false)
                       ));
        }
예제 #2
0
        private async Task <TResponse> SendAsync <TResponse>(IStsRequest request)
            where TResponse : IStsResponse
        {
            var httpRequest = new HttpRequestMessage(HttpMethod.Post, Endpoint)
            {
                Content = GetPostContent(StsRequestHelper.ToParams(request))
            };

            string responseText = await SendAsync(httpRequest).ConfigureAwait(false);

            return(StsSerializer <TResponse> .ParseXml(responseText));
        }