예제 #1
0
        private string GetClientSignatureAuthorizationQuery(WebParameterCollection parameters)
        {
            var signature = GetNewSignatureXAuth(parameters);

            parameters.Add("oauth_signature", signature);

            return(WriteAuthorizationQuery(parameters));
        }
예제 #2
0
        private string GetSignatureAuthorizationHeader(WebParameterCollection parameters)
        {
            var signature = GetNewSignature(parameters);

            parameters.Add("oauth_signature", signature);

            return(WriteAuthorizationHeader(parameters));
        }
예제 #3
0
        private void AddAuthParameters(ICollection <WebParameter> parameters, string timestamp, string nonce)
        {
            var authParameters = new WebParameterCollection
            {
                new WebParameter("oauth_consumer_key", ConsumerKey),
                new WebParameter("oauth_nonce", nonce),
                new WebParameter("oauth_signature_method", ToRequestValue(SignatureMethod)),
                new WebParameter("oauth_timestamp", timestamp),
                new WebParameter("oauth_version", Version ?? "1.0")
            };

            if (!IsNullOrBlank(Token))
            {
                authParameters.Add(new WebParameter("oauth_token", Token));
            }

            if (!IsNullOrBlank(CallbackUrl))
            {
                authParameters.Add(new WebParameter("oauth_callback", CallbackUrl));
            }

            if (!IsNullOrBlank(Verifier))
            {
                authParameters.Add(new WebParameter("oauth_verifier", Verifier));
            }

            if (!IsNullOrBlank(SessionHandle))
            {
                authParameters.Add(new WebParameter("oauth_session_handle", SessionHandle));
            }

            foreach (var authParameter in authParameters)
            {
                parameters.Add(authParameter);
            }
        }