コード例 #1
0
        public void ExchangeRequestTokenForAccessTokenPlainText()
        {
            OAuthConsumer consumer = CreateConsumer(SignatureMethod.PlainText);
            OAuthContext  context  =
                consumer.BuildExchangeRequestTokenForAccessTokenContext(
                    new TokenBase {
                ConsumerKey = "key", Token = "requestkey", TokenSecret = "requestsecret"
            }, null);
            TokenBase accessToken = provider.ExchangeRequestTokenForAccessToken(context);

            Assert.AreEqual("accesskey", accessToken.Token);
            Assert.AreEqual("accesssecret", accessToken.TokenSecret);
        }
コード例 #2
0
        public void Index(string signatureMethod)
        {
            // just populate the propertybag with a few uri's for testing purposes.

            signatureMethod = signatureMethod ?? SignatureMethod.PlainText;

            PropertyBag["signatureMethod"] = signatureMethod;

            OAuthConsumer consumer = _oAuthService.CreateConsumer(signatureMethod);

            PropertyBag["requestTokenUri"] = consumer.BuildRequestTokenContext(null).GenerateUrl();
            PropertyBag["exchangeRequestTokenForAccessTokenUri"] = consumer.BuildExchangeRequestTokenForAccessTokenContext(_testRequestToken, null).GenerateUrl();
            PropertyBag["accessProtectedResourceUri"]            = CreateApiResourceRequest(consumer, "/api/contacts/");
            PropertyBag["accessOneProtectedResourceUri"]         = CreateApiResourceRequest(consumer, "/api/contacts/1");
        }