コード例 #1
0
        public void PassTestSuite(params string[] scenarioName)
        {
            // Arrange
            var scenario = context.LoadScenario(scenarioName);

            // Add header 'X-Amz-Date' since the algorithm at this point expects it on the request
            scenario.Request.AddHeader(HeaderKeys.XAmzDateHeader, context.UtcNow.ToIso8601BasicDateTime());

            // Act
            var authorizationHeader = AuthorizationHeader.Build(
                context.UtcNow,
                context.RegionName,
                context.ServiceName,
                context.Credentials,
                scenario.ExpectedSignedHeaders,
                scenario.ExpectedCredentialScope,
                scenario.ExpectedStringToSign);

            // Assert
            authorizationHeader.ShouldBe(scenario.ExpectedAuthorizationHeader);
        }
コード例 #2
0
        public string ASV4()
        {
            // Build the canonical request
            (string canonicalRequest, string signedHeaders) = CanonicalRequest.Build("s3", _request2, null, null);

            // Build the string to sign
            (string stringToSign, string credentialScope) = StringToSign.Build(
                DateTime.UtcNow,
                "eu-west-1",
                "S3",
                canonicalRequest);

            // Build the authorization header
            string authorizationHeader = AuthorizationHeader.Build(
                DateTime.UtcNow,
                "eu-west-1",
                "S3",
                _credentials,
                signedHeaders,
                credentialScope,
                stringToSign);

            return(authorizationHeader);
        }
コード例 #3
0
    public string AWS4()
    {
        // Build the canonical request
        (string canonicalRequest, string signedHeaders) = CanonicalRequest.Build("s3", _request2, new Dictionary <string, IEnumerable <string> >(), string.Empty);

        // Build the string to sign
        (string stringToSign, string credentialScope) = StringToSign.Build(
            DateTime.UtcNow,
            "eu-west-1",
            "S3",
            canonicalRequest);

        // Build the authorization header
        string authorizationHeader = AuthorizationHeader.Build(
            DateTime.UtcNow,
            "eu-west-1",
            "S3",
            _credentials,
            signedHeaders,
            credentialScope,
            stringToSign);

        return(authorizationHeader);
    }