public static UrlEncodeRelaxed ( string value ) : string | ||
value | string | The value to escape. |
return | string |
public virtual OAuthWebQueryInfo BuildRequestTokenInfo(string method, WebParameterCollection parameters) { ValidateTokenRequestState(); if (parameters == null) { parameters = new WebParameterCollection(); } string timestamp = OAuthTools.GetTimestamp(); string nonce = OAuthTools.GetNonce(); AddAuthParameters(parameters, timestamp, nonce); string signatureBase = OAuthTools.ConcatenateRequestElements(method, RequestTokenUrl, parameters); string signature = OAuthTools.GetSignature(SignatureMethod, SignatureTreatment, signatureBase, ConsumerSecret); OAuthWebQueryInfo oAuthWebQueryInfo = new OAuthWebQueryInfo(); oAuthWebQueryInfo.WebMethod = method; oAuthWebQueryInfo.ParameterHandling = ParameterHandling; oAuthWebQueryInfo.ConsumerKey = ConsumerKey; oAuthWebQueryInfo.SignatureMethod = SignatureMethod.ToRequestValue(); oAuthWebQueryInfo.SignatureTreatment = SignatureTreatment; oAuthWebQueryInfo.Signature = signature; oAuthWebQueryInfo.Timestamp = timestamp; oAuthWebQueryInfo.Nonce = nonce; oAuthWebQueryInfo.Version = (Version ?? "1.0"); oAuthWebQueryInfo.Callback = OAuthTools.UrlEncodeRelaxed(CallbackUrl ?? ""); oAuthWebQueryInfo.TokenSecret = TokenSecret; oAuthWebQueryInfo.ConsumerSecret = ConsumerSecret; return(oAuthWebQueryInfo); }
/// <summary> /// Generates a <see cref="OAuthWebQueryInfo"/> instance to pass to an /// <see cref="IAuthenticator" /> for the purpose of requesting an /// unauthorized request token. /// </summary> /// <param name="method">The HTTP method for the intended request</param> /// <param name="parameters">Any existing, non-OAuth query parameters desired in the request</param> /// <seealso cref="http://oauth.net/core/1.0#anchor9"/> /// <returns></returns> public virtual OAuthWebQueryInfo BuildRequestTokenInfo(string method, WebParameterCollection parameters) { ValidateTokenRequestState(); if (parameters == null) { parameters = new WebParameterCollection(); } var timestamp = OAuthTools.GetTimestamp(); var nonce = OAuthTools.GetNonce(); AddAuthParameters(parameters, timestamp, nonce); var signatureBase = OAuthTools.ConcatenateRequestElements(method, RequestTokenUrl, parameters); var signature = OAuthTools.GetSignature(SignatureMethod, SignatureTreatment, signatureBase, ConsumerSecret); var info = new OAuthWebQueryInfo { WebMethod = method, ParameterHandling = ParameterHandling, ConsumerKey = ConsumerKey, SignatureMethod = SignatureMethod.ToRequestValue(), SignatureTreatment = SignatureTreatment, Signature = signature, Timestamp = timestamp, Nonce = nonce, Version = Version ?? "1.0", Callback = OAuthTools.UrlEncodeRelaxed(CallbackUrl ?? ""), TokenSecret = TokenSecret, ConsumerSecret = ConsumerSecret }; return(info); }
public WebPair(string name, string value, bool encode = false) { Name = name; Value = value; WebValue = encode ? OAuthTools.UrlEncodeRelaxed(value ?? "") : value; Encode = encode; }