Example #1
0
        private void AddAuthParameters(
            ICollection <WebParameter> parameters,
            string timestamp,
            string nonce)
        {
            WebParameterCollection parameterCollection = new WebParameterCollection()
            {
                new WebParameter("oauth_consumer_key", this.ConsumerKey),
                new WebParameter("oauth_nonce", nonce),
                new WebParameter("oauth_signature_method", OAuthRequest.ToRequestValue(this.SignatureMethod)),
                new WebParameter("oauth_timestamp", timestamp),
                new WebParameter("oauth_version", this.Version ?? "1.0")
            };

            if (!OAuthRequest.IsNullOrBlank(this.Token))
            {
                parameterCollection.Add(new WebParameter("oauth_token", this.Token));
            }
            if (!OAuthRequest.IsNullOrBlank(this.CallbackUrl))
            {
                parameterCollection.Add(new WebParameter("oauth_callback", this.CallbackUrl));
            }
            if (!OAuthRequest.IsNullOrBlank(this.Verifier))
            {
                parameterCollection.Add(new WebParameter("oauth_verifier", this.Verifier));
            }
            if (!OAuthRequest.IsNullOrBlank(this.SessionHandle))
            {
                parameterCollection.Add(new WebParameter("oauth_session_handle", this.SessionHandle));
            }
            foreach (WebParameter webParameter in parameterCollection)
            {
                parameters.Add(webParameter);
            }
        }
Example #2
0
 private void AddXAuthParameters(
     ICollection <WebParameter> parameters,
     string timestamp,
     string nonce)
 {
     foreach (WebParameter webParameter in new WebParameterCollection()
     {
         new WebParameter("x_auth_username", this.ClientUsername),
         new WebParameter("x_auth_password", this.ClientPassword),
         new WebParameter("x_auth_mode", "client_auth"),
         new WebParameter("oauth_consumer_key", this.ConsumerKey),
         new WebParameter("oauth_signature_method", OAuthRequest.ToRequestValue(this.SignatureMethod)),
         new WebParameter("oauth_timestamp", timestamp),
         new WebParameter("oauth_nonce", nonce),
         new WebParameter("oauth_version", this.Version ?? "1.0")
     })
     {
         parameters.Add(webParameter);
     }
 }