diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs | 46 | ||||
-rw-r--r-- | src/DotNetOpenAuth/OAuth/ChannelElements/SigningBindingElementBase.cs | 2 |
2 files changed, 24 insertions, 24 deletions
diff --git a/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs b/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs index d8fb613..9a74eb5 100644 --- a/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs +++ b/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs @@ -75,37 +75,17 @@ namespace DotNetOpenAuth.OAuth.ChannelElements { protected internal ITokenManager TokenManager { get; private set; } /// <summary> - /// Encodes the names and values that are part of the message per OAuth 1.0 section 5.1. + /// Uri-escapes the names and values in a dictionary per OAuth 1.0 section 5.1. /// </summary> /// <param name="message">The message with data to encode.</param> /// <returns>A dictionary of name-value pairs with their strings encoded.</returns> - internal static IDictionary<string, string> GetEncodedParameters(IProtocolMessage message) { + internal static IDictionary<string, string> GetUriEscapedParameters(IProtocolMessage message) { var encodedDictionary = new Dictionary<string, string>(); - EncodeParameters(new MessageDictionary(message), encodedDictionary); + UriEscapeParameters(new MessageDictionary(message), encodedDictionary); return encodedDictionary; } /// <summary> - /// Encodes the names and values in a dictionary per OAuth 1.0 section 5.1. - /// </summary> - /// <param name="source">The dictionary with names and values to encode.</param> - /// <param name="destination">The dictionary to add the encoded pairs to.</param> - internal static void EncodeParameters(IDictionary<string, string> source, IDictionary<string, string> destination) { - if (source == null) { - throw new ArgumentNullException("source"); - } - if (destination == null) { - throw new ArgumentNullException("destination"); - } - - foreach (var pair in source) { - var key = Uri.EscapeDataString(pair.Key); - var value = Uri.EscapeDataString(pair.Value); - destination.Add(key, value); - } - } - - /// <summary> /// Initializes a web request for sending by attaching a message to it. /// Use this method to prepare a protected resource request that you do NOT /// expect an OAuth message response to. @@ -253,6 +233,26 @@ namespace DotNetOpenAuth.OAuth.ChannelElements { } /// <summary> + /// Uri-escapes the names and values in a dictionary per OAuth 1.0 section 5.1. + /// </summary> + /// <param name="source">The dictionary with names and values to encode.</param> + /// <param name="destination">The dictionary to add the encoded pairs to.</param> + private static void UriEscapeParameters(IDictionary<string, string> source, IDictionary<string, string> destination) { + if (source == null) { + throw new ArgumentNullException("source"); + } + if (destination == null) { + throw new ArgumentNullException("destination"); + } + + foreach (var pair in source) { + var key = Uri.EscapeDataString(pair.Key); + var value = Uri.EscapeDataString(pair.Value); + destination.Add(key, value); + } + } + + /// <summary> /// Prepares to send a request to the Service Provider via the Authorization header. /// </summary> /// <param name="requestMessage">The message to be transmitted to the ServiceProvider.</param> diff --git a/src/DotNetOpenAuth/OAuth/ChannelElements/SigningBindingElementBase.cs b/src/DotNetOpenAuth/OAuth/ChannelElements/SigningBindingElementBase.cs index 704a362..f2c4832 100644 --- a/src/DotNetOpenAuth/OAuth/ChannelElements/SigningBindingElementBase.cs +++ b/src/DotNetOpenAuth/OAuth/ChannelElements/SigningBindingElementBase.cs @@ -151,7 +151,7 @@ namespace DotNetOpenAuth.OAuth.ChannelElements { endpoint.Fragment = null; signatureBaseStringElements.Add(endpoint.Uri.AbsoluteUri); - var encodedDictionary = OAuthChannel.GetEncodedParameters(message); + var encodedDictionary = OAuthChannel.GetUriEscapedParameters(message); encodedDictionary.Remove("oauth_signature"); var sortedKeyValueList = new List<KeyValuePair<string, string>>(encodedDictionary); sortedKeyValueList.Sort(SignatureBaseStringParameterComparer); |