Amazon.Runtime.Internal.Auth.AWS4Signer.SignRequest C# (CSharp) Метод

SignRequest() публичный Метод

Calculates and signs the specified request using the AWS4 signing protocol by using the AWS account credentials given in the method parameters.
Parameters passed as part of the resource path should be uri-encoded prior to entry to the signer. Parameters passed in the request.Parameters collection should be not be encoded; encoding will be done for these parameters as part of the construction of the canonical request.
/// If any problems are encountered while signing the request. ///
public SignRequest ( IRequest request, IClientConfig clientConfig, RequestMetrics metrics, string awsAccessKeyId, string awsSecretAccessKey ) : AWS4SigningResult
request IRequest /// The request to compute the signature for. Additional headers mandated by the AWS4 protocol /// ('host' and 'x-amz-date') will be added to the request before signing. ///
clientConfig IClientConfig /// Client configuration data encompassing the service call (notably authentication /// region, endpoint and service name). ///
metrics Amazon.Runtime.Internal.Util.RequestMetrics /// Metrics for the request. ///
awsAccessKeyId string /// The AWS public key for the account making the service call. ///
awsSecretAccessKey string /// The AWS secret key for the account making the call, in clear text. ///
Результат AWS4SigningResult
        public AWS4SigningResult SignRequest(IRequest request,
                                             IClientConfig clientConfig,
                                             RequestMetrics metrics,
                                             string awsAccessKeyId,
                                             string awsSecretAccessKey)
        {
            var signedAt = InitializeHeaders(request.Headers, request.Endpoint);
            var service = DetermineService(clientConfig);
            var region = DetermineSigningRegion(clientConfig, service, request.AlternateEndpoint, request);

            var parametersToCanonicalize = GetParametersToCanonicalize(request);
            var canonicalParameters = CanonicalizeQueryParameters(parametersToCanonicalize);
            var bodyHash = SetRequestBodyHash(request);
            var sortedHeaders = SortAndPruneHeaders(request.Headers);
            
            var canonicalRequest = CanonicalizeRequest(request.Endpoint,
                                                       request.ResourcePath,
                                                       request.HttpMethod,
                                                       sortedHeaders,
                                                       canonicalParameters,
                                                       bodyHash);
            if (metrics != null)
                metrics.AddProperty(Metric.CanonicalRequest, canonicalRequest);

            return ComputeSignature(awsAccessKeyId,
                                    awsSecretAccessKey,
                                    region,
                                    signedAt,
                                    service,
                                    CanonicalizeHeaderNames(sortedHeaders),
                                    canonicalRequest,
                                    metrics);
        }