protected AccessTokenRequest(Uri requestUri, ClientCredentials credentials, NegotiationToken negociationToken, string verifierCode)
 {
     this.requestUri = requestUri;
     this.clientCredentials = credentials;
     this.negotiationToken = negociationToken;
     this.verifierCode = verifierCode;
 }
コード例 #2
0
        public void WithToken()
        {
            ClientCredentials credentials = new ClientCredentials("key", "secret");
            NegotiationToken  token       = new NegotiationToken("requestkey", "requestsecret");
            string            baseString  = "POST&http%3A%2F%2Fterm.ie%2Foauth%2Fexample%2Faccess_token.php&oauth_consumer_key%3Dkey%26oauth_nonce%3D6971488%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1327336019%26oauth_token%3Drequestkey%26oauth_version%3D1.0";

            Signature signature = new HmacSha1Signature(baseString, credentials, token);

            Assert.AreEqual("HMAC-SHA1", signature.Method);
            Assert.AreEqual("TtSu4YZhB3uuWPwmCetVARH5f7c%3D", signature.Value);
        }
        public void WithToken()
        {
            ClientCredentials credentials = new ClientCredentials("key", "secret");
            NegotiationToken token = new NegotiationToken("requestkey", "requestsecret");
            string baseString = "POST&http%3A%2F%2Fterm.ie%2Foauth%2Fexample%2Faccess_token.php&oauth_consumer_key%3Dkey%26oauth_nonce%3D6971488%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1327336019%26oauth_token%3Drequestkey%26oauth_version%3D1.0";

            Signature signature = new HmacSha1Signature(baseString, credentials, token);

            Assert.AreEqual("HMAC-SHA1", signature.Method);
            Assert.AreEqual("TtSu4YZhB3uuWPwmCetVARH5f7c%3D", signature.Value);
        }
コード例 #4
0
        public static Uri Create(Uri authorize, NegotiationToken negotiationToken)
        {
            UriBuilder builder = new UriBuilder(authorize);

            if (QueryStringContainsParameters(builder.Query))
            {
                builder.Query = builder.Query.Substring(1) + "&" + OAuthTokenParameter(negotiationToken);
            }
            else
            {
                builder.Query = OAuthTokenParameter(negotiationToken);
            }

            return builder.Uri;
        }
コード例 #5
0
 private static string OAuthTokenParameter(NegotiationToken negotiationToken)
 {
     return AuthorizationHeaderFields.TOKEN + "=" + negotiationToken.Value;
 }
コード例 #6
0
 public static Uri Create(string authorize, NegotiationToken negotiationToken)
 {
     return Create(new Uri(authorize), negotiationToken);
 }
 public static AccessTokenRequest Create(Uri requestUri, ClientCredentials credentials, NegotiationToken negociationToken)
 {
     return new AccessTokenRequest(requestUri, credentials, negociationToken, "");
 }
 public static AccessTokenRequest Create(Uri requestUri, ClientCredentials credentials, NegotiationToken negociationToken, string verifierCode)
 {
     return new AccessTokenRequest(requestUri, credentials, negociationToken, verifierCode);
 }