diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-03-14 15:19:27 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-03-14 15:19:27 -0700 |
commit | 37d699e59e096802abbf9a2e976c8bc2f6ad8404 (patch) | |
tree | 696695f5ef9a7ff1db07783a46ef14df9657c263 /src/DotNetOpenAuth/OAuth/ChannelElements/SigningBindingElementBase.cs | |
parent | fc5e2ea3ff4d9aac85c9b40084d86c3fc72c65ce (diff) | |
download | DotNetOpenAuth-37d699e59e096802abbf9a2e976c8bc2f6ad8404.zip DotNetOpenAuth-37d699e59e096802abbf9a2e976c8bc2f6ad8404.tar.gz DotNetOpenAuth-37d699e59e096802abbf9a2e976c8bc2f6ad8404.tar.bz2 |
Refactored MessageDescription to be per-Channel instead of appdomain static.
This allows for special scenarios (like OSIS tests) where individual tests might need to contrive special message serialization rules.
Diffstat (limited to 'src/DotNetOpenAuth/OAuth/ChannelElements/SigningBindingElementBase.cs')
-rw-r--r-- | src/DotNetOpenAuth/OAuth/ChannelElements/SigningBindingElementBase.cs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/DotNetOpenAuth/OAuth/ChannelElements/SigningBindingElementBase.cs b/src/DotNetOpenAuth/OAuth/ChannelElements/SigningBindingElementBase.cs index f874363..3c0e840 100644 --- a/src/DotNetOpenAuth/OAuth/ChannelElements/SigningBindingElementBase.cs +++ b/src/DotNetOpenAuth/OAuth/ChannelElements/SigningBindingElementBase.cs @@ -7,14 +7,17 @@ namespace DotNetOpenAuth.OAuth.ChannelElements { using System; using System.Collections.Generic; + using System.Diagnostics.Contracts; using System.Globalization; using System.Text; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Bindings; + using DotNetOpenAuth.Messaging.Reflection; /// <summary> /// A binding element that signs outgoing messages and verifies the signature on incoming messages. /// </summary> + [ContractClass(typeof(SigningBindingElementBaseContract))] public abstract class SigningBindingElementBase : ITamperProtectionChannelBindingElement { /// <summary> /// The signature method this binding element uses. @@ -136,12 +139,17 @@ namespace DotNetOpenAuth.OAuth.ChannelElements { /// <summary> /// Constructs the OAuth Signature Base String and returns the result. /// </summary> - /// <param name="message">The message to derive the signature base string from.</param> + /// <param name="message">The message.</param> + /// <param name="messageDictionary">The message to derive the signature base string from.</param> /// <returns>The signature base string.</returns> /// <remarks> /// This method implements OAuth 1.0 section 9.1. /// </remarks> - protected static string ConstructSignatureBaseString(ITamperResistantOAuthMessage message) { + internal static string ConstructSignatureBaseString(ITamperResistantOAuthMessage message, MessageDictionary messageDictionary) { + Contract.Requires(message != null); + Contract.Requires(messageDictionary != null); + Contract.Requires(messageDictionary.Message == message); + if (String.IsNullOrEmpty(message.HttpMethod)) { throw new ArgumentException( string.Format( @@ -161,7 +169,7 @@ namespace DotNetOpenAuth.OAuth.ChannelElements { endpoint.Fragment = null; signatureBaseStringElements.Add(endpoint.Uri.AbsoluteUri); - var encodedDictionary = OAuthChannel.GetUriEscapedParameters(message); + var encodedDictionary = OAuthChannel.GetUriEscapedParameters(messageDictionary); encodedDictionary.Remove("oauth_signature"); var sortedKeyValueList = new List<KeyValuePair<string, string>>(encodedDictionary); sortedKeyValueList.Sort(SignatureBaseStringParameterComparer); |