Exemplo n.º 1
0
        public void CreateHmacSha1AuthorizationHeader2(string expectedHeader, string uri, string httpMethod, string consumerToken, string consumerSecret, string callback, string nonce, long timestamp)
        {
            TestNonceCreator nonceCreator = new TestNonceCreator(nonce);
            TestSystemTime   systemTime   = new TestSystemTime(timestamp);

            string header = OAuthUtility.CreateHmacSha1AuthorizationHeaderValue(new Uri(uri), httpMethod, consumerToken, consumerSecret, callback, nonceCreator, systemTime);

            Assert.AreEqual(expectedHeader, header);
        }
Exemplo n.º 2
0
        public void CreateHmacSha1AuthorizationHeader(string uri, string httpMethod, string consumerToken, string consumerSecret, string nonce, long timestamp, string expectedSignature)
        {
            TestNonceCreator nonceCreator = new TestNonceCreator(nonce);
            TestSystemTime   systemTime   = new TestSystemTime(timestamp);

            string header = OAuthUtility.CreateHmacSha1AuthorizationHeaderValue(new Uri(uri), httpMethod, consumerToken, consumerSecret, nonceCreator, systemTime);

            AssertAuthorizationHeader(header, new[] { "oauth_consumer_key", consumerToken, "oauth_nonce", nonce, "oauth_timestamp", timestamp.ToInvariantString(), "oauth_signature_method", "HMAC-SHA1", "oauth_version", "1.0", "oauth_signature", expectedSignature });
        }