Пример #1
0
        public OAuthRequestBuilder(Uri requestUri, OAuthTokens tokens)
        {
            RequestUriWithoutQuery = new Uri(requestUri.AbsoluteWithoutQuery());

            QueryParams = requestUri.GetQueryParams()
                          .Select(p => new OAuthParameter(p.Key, p.Value))
                          .ToList();

            EncodedRequestUri = GetEncodedUri(requestUri, QueryParams);

            Version         = new OAuthParameter("oauth_version", "1.0");
            Nonce           = new OAuthParameter("oauth_nonce", GenerateNonce());
            Timestamp       = new OAuthParameter("oauth_timestamp", GenerateTimeStamp());
            SignatureMethod = new OAuthParameter("oauth_signature_method", "HMAC-SHA1");
            ConsumerKey     = new OAuthParameter("oauth_consumer_key", tokens["ConsumerKey"]);
            ConsumerSecret  = new OAuthParameter("oauth_consumer_secret", tokens["ConsumerSecret"]);
            Token           = new OAuthParameter("oauth_token", tokens["AccessToken"]);
            TokenSecret     = new OAuthParameter("oauth_token_secret", tokens["AccessTokenSecret"]);
        }
Пример #2
0
        public OAuthRequestBuilder(Uri requestUri, OAuthTokens tokens)
        {
            RequestUriWithoutQuery = new Uri(requestUri.AbsoluteWithoutQuery());

            QueryParams = requestUri.GetQueryParams()
                                        .Select(p => new OAuthParameter(p.Key, p.Value))
                                        .ToList();

            EncodedRequestUri = GetEncodedUri(requestUri, QueryParams);

            Version = new OAuthParameter("oauth_version", "1.0");
            Nonce = new OAuthParameter("oauth_nonce", GenerateNonce());
            Timestamp = new OAuthParameter("oauth_timestamp", GenerateTimeStamp());
            SignatureMethod = new OAuthParameter("oauth_signature_method", "HMAC-SHA1");
            ConsumerKey = new OAuthParameter("oauth_consumer_key", tokens["ConsumerKey"]);
            ConsumerSecret = new OAuthParameter("oauth_consumer_secret", tokens["ConsumerSecret"]);
            Token = new OAuthParameter("oauth_token", tokens["AccessToken"]);
            TokenSecret = new OAuthParameter("oauth_token_secret", tokens["AccessTokenSecret"]);
        }