diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2008-09-20 17:17:39 -0700 |
---|---|---|
committer | Andrew <andrewarnott@gmail.com> | 2008-09-20 17:17:39 -0700 |
commit | b11a9a3a69ab79c92e3d1fb0de501c5311134723 (patch) | |
tree | 7ba9031a2728dc2123bbf9f2f06f0ce69984b6bc /src/DotNetOAuth/Messaging/Channel.cs | |
parent | ccd062ccfaa33aed1da1e39e62c07348392f4367 (diff) | |
download | DotNetOpenAuth-b11a9a3a69ab79c92e3d1fb0de501c5311134723.zip DotNetOpenAuth-b11a9a3a69ab79c92e3d1fb0de501c5311134723.tar.gz DotNetOpenAuth-b11a9a3a69ab79c92e3d1fb0de501c5311134723.tar.bz2 |
Removed EnsureCompleteMessageBindingElement and moved its functionality back into the Channel class.
Diffstat (limited to 'src/DotNetOAuth/Messaging/Channel.cs')
-rw-r--r-- | src/DotNetOAuth/Messaging/Channel.cs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/DotNetOAuth/Messaging/Channel.cs b/src/DotNetOAuth/Messaging/Channel.cs index be3cdf2..db6cc10 100644 --- a/src/DotNetOAuth/Messaging/Channel.cs +++ b/src/DotNetOAuth/Messaging/Channel.cs @@ -84,9 +84,6 @@ namespace DotNetOAuth.Messaging { this.messageTypeProvider = messageTypeProvider;
this.bindingElements = new List<IChannelBindingElement>(ValidateAndPrepareBindingElements(bindingElements));
-
- // Add a complete message check as a last outgoing step.
- this.bindingElements.Add(new EnsureCompleteMessageBindingElement());
}
/// <summary>
@@ -505,6 +502,9 @@ namespace DotNetOAuth.Messaging { if ((message.RequiredProtection & appliedProtection) != message.RequiredProtection) {
throw new UnprotectedMessageException(message, appliedProtection);
}
+
+ EnsureValidMessageParts(message);
+ message.EnsureValidMessage();
}
/// <summary>
@@ -536,14 +536,10 @@ namespace DotNetOAuth.Messaging { private void EnsureValidMessageParts(IProtocolMessage message) {
Debug.Assert(message != null, "message == null");
+
+ MessageDictionary dictionary = new MessageDictionary(message);
MessageDescription description = MessageDescription.Get(message.GetType());
- List<MessagePart> invalidParts = description.Mapping.Values.Where(part => !part.IsValidValue(message)).ToList();
- if (invalidParts.Count > 0) {
- throw new ProtocolException(string.Format(
- CultureInfo.CurrentCulture,
- MessagingStrings.InvalidMessageParts,
- string.Join(", ", invalidParts.Select(part => part.Name).ToArray())));
- }
+ description.EnsureRequiredMessagePartsArePresent(dictionary.Keys);
}
}
}
|