diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2008-09-26 00:08:23 -0700 |
---|---|---|
committer | Andrew <andrewarnott@gmail.com> | 2008-09-26 00:08:23 -0700 |
commit | 39078bd7bc118b968758c198765db7932752c9f4 (patch) | |
tree | 6d48eaf7dbb7dea66ba5b17747ed23980b09d0f2 /src/DotNetOAuth/Messaging/Channel.cs | |
parent | 49c26eba391f16d197697281d6122b9db42b9e11 (diff) | |
download | DotNetOpenAuth-39078bd7bc118b968758c198765db7932752c9f4.zip DotNetOpenAuth-39078bd7bc118b968758c198765db7932752c9f4.tar.gz DotNetOpenAuth-39078bd7bc118b968758c198765db7932752c9f4.tar.bz2 |
Added capability to send the final authorized request for protected resources.
Diffstat (limited to 'src/DotNetOAuth/Messaging/Channel.cs')
-rw-r--r-- | src/DotNetOAuth/Messaging/Channel.cs | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/src/DotNetOAuth/Messaging/Channel.cs b/src/DotNetOAuth/Messaging/Channel.cs index 1d398aa..fdca618 100644 --- a/src/DotNetOAuth/Messaging/Channel.cs +++ b/src/DotNetOAuth/Messaging/Channel.cs @@ -491,6 +491,35 @@ namespace DotNetOAuth.Messaging { }
/// <summary>
+ /// Prepares a message for transmit by applying signatures, nonces, etc.
+ /// </summary>
+ /// <param name="message">The message to prepare for sending.</param>
+ /// <remarks>
+ /// This method should NOT be called by derived types
+ /// except when sending ONE WAY request messages.
+ /// </remarks>
+ protected void PrepareMessageForSending(IProtocolMessage message) {
+ if (message == null) {
+ throw new ArgumentNullException("message");
+ }
+
+ MessageProtection appliedProtection = MessageProtection.None;
+ foreach (IChannelBindingElement bindingElement in this.bindingElements) {
+ if (bindingElement.PrepareMessageForSending(message)) {
+ appliedProtection |= bindingElement.Protection;
+ }
+ }
+
+ // Ensure that the message's protection requirements have been satisfied.
+ if ((message.RequiredProtection & appliedProtection) != message.RequiredProtection) {
+ throw new UnprotectedMessageException(message, appliedProtection);
+ }
+
+ EnsureValidMessageParts(message);
+ message.EnsureValidMessage();
+ }
+
+ /// <summary>
/// Calculates a fairly accurate estimation on the size of a message that contains
/// a given set of fields.
/// </summary>
@@ -601,29 +630,6 @@ namespace DotNetOAuth.Messaging { }
/// <summary>
- /// Prepares a message for transmit by applying signatures, nonces, etc.
- /// </summary>
- /// <param name="message">The message to prepare for sending.</param>
- private void PrepareMessageForSending(IProtocolMessage message) {
- Debug.Assert(message != null, "message == null");
-
- MessageProtection appliedProtection = MessageProtection.None;
- foreach (IChannelBindingElement bindingElement in this.bindingElements) {
- if (bindingElement.PrepareMessageForSending(message)) {
- appliedProtection |= bindingElement.Protection;
- }
- }
-
- // Ensure that the message's protection requirements have been satisfied.
- if ((message.RequiredProtection & appliedProtection) != message.RequiredProtection) {
- throw new UnprotectedMessageException(message, appliedProtection);
- }
-
- EnsureValidMessageParts(message);
- message.EnsureValidMessage();
- }
-
- /// <summary>
/// Verifies the integrity and applicability of an incoming message.
/// </summary>
/// <param name="message">The message just received.</param>
|