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 (Token == null) { Token = string.Empty; } 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 && RequestMethod == "POST") { allParameters.AddRange(FormEncodedParameters.ToQueryParameters()); } if (QueryParameters != null) { allParameters.AddRange(QueryParameters.ToQueryParameters()); } if (Cookies != null) { allParameters.AddRange(Cookies.ToQueryParameters()); } if (AuthorizationHeaderParameters != null) { allParameters.AddRange(AuthorizationHeaderParameters.ToQueryParameters().Where(q => q.Key != Parameters.Realm)); } // remove the signature parameter and the token parameter if it's not specified if (string.IsNullOrEmpty(Token)) { allParameters.RemoveAll(param => param.Key == Parameters.OAuth_Token); } allParameters.RemoveAll(param => param.Key == Parameters.OAuth_Signature); //allParameters.RemoveAll(param => param.Key == Parameters.OAuth_Token && string.IsNullOrEmpty(param.Value)); // build the uri return(UriUtility.FormatParameters(RequestMethod, new Uri(NormalizedRequestUrl), allParameters)); }
public string GenerateSignatureBase() { if (Token == null) { Token = string.Empty; } if (string.IsNullOrEmpty(ConsumerKey)) { throw Error.MissingRequiredOAuthParameter("ConsumerKey"); } if (string.IsNullOrEmpty(SignatureMethod)) { throw Error.MissingRequiredOAuthParameter("SignatureMethod"); } if (string.IsNullOrEmpty(RequestMethod)) { throw Error.RequestMethodHasNotBeenAssigned("RequestMethod"); } var allParameters = new List <QueryParameter>(); if (FormEncodedParameters != null) { allParameters.AddRange(FormEncodedParameters.ToQueryParameters()); } if (QueryParameters != null) { allParameters.AddRange(QueryParameters.ToQueryParameters()); } if (Cookies != null) { allParameters.AddRange(Cookies.ToQueryParameters()); } if (AuthorizationHeaderParameters != null) { allParameters.AddRange( AuthorizationHeaderParameters.ToQueryParameters().Where(q => q.Name != Parameters.Realm)); } // remove the signature parameter allParameters.RemoveAll(param => param.Name == Parameters.OAuth_Signature); // build the uri return(UriUtility.FormatParameters(RequestMethod, new Uri(NormalizedRequestUrl), allParameters)); }
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(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); }