public IEnumerable <string> GenerateSignatureBase() { if (string.IsNullOrEmpty(ConsumerKey)) { throw Error.MissingRequiredOAuthParameter(this, Parameters.OAuth_Consumer_Key); } if (string.IsNullOrEmpty(SignatureMethod)) { throw Error.MissingRequiredOAuthParameter(this, Parameters.OAuth_Signature_Method); } if (string.IsNullOrEmpty(RequestMethod)) { throw Error.RequestMethodHasNotBeenAssigned("RequestMethod"); } if (IncludeOAuthRequestBodyHashInSignature) { GenerateAndSetBodyHash(); } var allParameters = new List <QueryParameter>(); //fix for issue: http://groups.google.com/group/oauth/browse_thread/thread/42ef5fecc54a7e9a/a54e92b13888056c?hl=en&lnk=gst&q=Signing+PUT+Request#a54e92b13888056c if (FormEncodedParameters != null && RequestMethod == "POST") { allParameters.AddRange(FormEncodedParameters.ToQueryParametersExcludingTokenSecret()); } if (QueryParameters != null) { allParameters.AddRange(QueryParameters.ToQueryParametersExcludingTokenSecret()); } if (Cookies != null) { allParameters.AddRange(Cookies.ToQueryParametersExcludingTokenSecret()); } if (AuthorizationHeaderParameters != null) { allParameters.AddRange( AuthorizationHeaderParameters.ToQueryParametersExcludingTokenSecret() .Where(q => q.Key != Parameters.Realm)); } // patch from http://code.google.com/p/devdefined-tools/issues/detail?id=10 //if(RawContent != null) // allParameters.Add(new QueryParameter("raw", RawContent)); allParameters.RemoveAll(param => param.Key == Parameters.OAuth_Signature); foreach ( var signatureBase in UriUtility.FormatParameters(RequestMethod, new Uri(NormalizedRequestUrl), allParameters)) { yield return(signatureBase); } }
public string GenerateSignatureBase() { if (string.IsNullOrEmpty(ConsumerKey)) { throw Error.MissingRequiredOAuthParameter(this, Parameters.OAuth_Consumer_Key); } if (string.IsNullOrEmpty(SignatureMethod)) { throw Error.MissingRequiredOAuthParameter(this, Parameters.OAuth_Signature_Method); } if (string.IsNullOrEmpty(RequestMethod)) { throw Error.RequestMethodHasNotBeenAssigned("RequestMethod"); } var allParameters = new List <QueryParameter>(); //fix for issue: http://groups.google.com/group/oauth/browse_thread/thread/42ef5fecc54a7e9a/a54e92b13888056c?hl=en&lnk=gst&q=Signing+PUT+Request#a54e92b13888056c if (FormEncodedParameters != null && RequestMethod == "POST") { allParameters.AddRange(FormEncodedParameters.ToQueryParametersExcludingTokenSecret()); } if (QueryParameters != null) { allParameters.AddRange(QueryParameters.ToQueryParametersExcludingTokenSecret()); } if (Cookies != null) { allParameters.AddRange(Cookies.ToQueryParametersExcludingTokenSecret()); } if (AuthorizationHeaderParameters != null) { allParameters.AddRange(AuthorizationHeaderParameters.ToQueryParametersExcludingTokenSecret().Where(q => q.Key != Parameters.Realm)); } allParameters.RemoveAll(param => param.Key == Parameters.OAuth_Signature); string signatureBase = UriUtility.FormatParameters(RequestMethod, new Uri(NormalizedRequestUrl), allParameters); return(signatureBase); }
public string GenerateSignatureBase() { if (string.IsNullOrEmpty(ConsumerKey)) { throw Error.MissingRequiredOAuthParameter(this, Parameters.OAuth_Consumer_Key); } if (string.IsNullOrEmpty(SignatureMethod)) { throw Error.MissingRequiredOAuthParameter(this, Parameters.OAuth_Signature_Method); } if (string.IsNullOrEmpty(RequestMethod)) { throw Error.RequestMethodHasNotBeenAssigned("RequestMethod"); } var allParameters = new List <QueryParameter>(); if (FormEncodedParameters != null) { allParameters.AddRange(UriUtility.ToQueryParametersExcludingTokenSecret(FormEncodedParameters)); } if (QueryParameters != null) { allParameters.AddRange(UriUtility.ToQueryParametersExcludingTokenSecret(QueryParameters)); } if (Cookies != null) { allParameters.AddRange(UriUtility.ToQueryParametersExcludingTokenSecret(Cookies)); } if (AuthorizationHeaderParameters != null) { allParameters.AddRange(UriUtility.ToQueryParametersExcludingTokenSecretAndRealm(AuthorizationHeaderParameters)); } allParameters.RemoveAll(param => param.Key == Parameters.OAuth_Signature); string signatureBase = UriUtility.FormatParameters(RequestMethod, new Uri(NormalizedRequestUrl), allParameters); return(signatureBase); }