Пример #1
0
        public IRestRequest SignRequest(IRestRequest restRequest, RestClient restClient, string contentType)
        {
            // Seller APIs
            LWAAuthorizationCredentials lwaAuthorizationCredentials = new LWAAuthorizationCredentials
            {
                ClientId     = ClientId,
                ClientSecret = ClientSecret,
                RefreshToken = RefreshToken,
                Endpoint     = Endpoint
            };
            AWSAuthenticationCredentials awsAuthenticationCredentials = new AWSAuthenticationCredentials
            {
                AccessKeyId = AccessKeyId,
                SecretKey   = SecretKey,
                Region      = Region
            };

            restRequest = new AWSSigV4Signer(awsAuthenticationCredentials)
                          .Sign(restRequest, restClient.BaseUrl.Host);

            restRequest.AddHeader("Content-type", contentType);

            restRequest.AddHeader("user-agent", "My YouTube App 1.0 (Language=csharp;Platform=Windows/10)");

            return(restRequest);
        }
Пример #2
0
        public AWSSigV4SignerTest()
        {
            request = new HttpRequestMessage(HttpMethod.Get, TestUri);

            AWSAuthenticationCredentials authenticationCredentials = new AWSAuthenticationCredentials
            {
                AccessKeyId = TestAccessKeyId,
                SecretKey   = TestSecretKey,
                Region      = TestRegion
            };

            mockAWSSignerHelper  = new Mock <AWSSignerHelper>();
            sigV4SignerUnderTest = new AWSSigV4Signer(authenticationCredentials);
            sigV4SignerUnderTest.AwsSignerHelper = mockAWSSignerHelper.Object;
        }
        public AWSSigV4SignerTest()
        {
            request = new RestRequest(TestResourcePath, Method.GET);

            AWSAuthenticationCredentials authenticationCredentials = new AWSAuthenticationCredentials
            {
                AccessKeyId = TestAccessKeyId,
                SecretKey   = TestSecretKey,
                Region      = TestRegion
            };

            mockAWSSignerHelper  = new Mock <AWSSignerHelper>();
            sigV4SignerUnderTest = new AWSSigV4Signer(authenticationCredentials);
            sigV4SignerUnderTest.AwsSignerHelper = mockAWSSignerHelper.Object;
        }