summaryrefslogtreecommitdiffstats
path: root/src/DotNetOAuth
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2008-10-08 11:53:25 -0700
committerAndrew <andrewarnott@gmail.com>2008-10-08 11:53:25 -0700
commit1e707db5f5551a545ad0bbcc71df9d19f2a79029 (patch)
treee4824dcff0ea75d650314c1826023f0e3b382443 /src/DotNetOAuth
parent2276413c733f6a26e9b366214bdfb5677e711c75 (diff)
downloadDotNetOpenAuth-1e707db5f5551a545ad0bbcc71df9d19f2a79029.zip
DotNetOpenAuth-1e707db5f5551a545ad0bbcc71df9d19f2a79029.tar.gz
DotNetOpenAuth-1e707db5f5551a545ad0bbcc71df9d19f2a79029.tar.bz2
Reworked cloning of signing binding elements, and a bit of the appendix sample test.
Diffstat (limited to 'src/DotNetOAuth')
-rw-r--r--src/DotNetOAuth/ChannelElements/HmacSha1SigningBindingElement.cs3
-rw-r--r--src/DotNetOAuth/ChannelElements/PlainTextSigningBindingElement.cs2
-rw-r--r--src/DotNetOAuth/ChannelElements/RsaSha1SigningBindingElement.cs3
-rw-r--r--src/DotNetOAuth/ChannelElements/SigningBindingElementBase.cs6
-rw-r--r--src/DotNetOAuth/ChannelElements/SigningBindingElementChain.cs2
-rw-r--r--src/DotNetOAuth/Messaging/ITamperProtectionChannelBindingElement.cs8
6 files changed, 16 insertions, 8 deletions
diff --git a/src/DotNetOAuth/ChannelElements/HmacSha1SigningBindingElement.cs b/src/DotNetOAuth/ChannelElements/HmacSha1SigningBindingElement.cs
index 6b41542..f1455e8 100644
--- a/src/DotNetOAuth/ChannelElements/HmacSha1SigningBindingElement.cs
+++ b/src/DotNetOAuth/ChannelElements/HmacSha1SigningBindingElement.cs
@@ -8,6 +8,7 @@ namespace DotNetOAuth.ChannelElements {
using System;
using System.Security.Cryptography;
using System.Text;
+ using DotNetOAuth.Messaging;
/// <summary>
/// A binding element that signs outgoing messages and verifies the signature on incoming messages.
@@ -41,7 +42,7 @@ namespace DotNetOAuth.ChannelElements {
/// Clones this instance.
/// </summary>
/// <returns>A new instance of the binding element.</returns>
- protected override object Clone() {
+ protected override ITamperProtectionChannelBindingElement Clone() {
return new HmacSha1SigningBindingElement();
}
}
diff --git a/src/DotNetOAuth/ChannelElements/PlainTextSigningBindingElement.cs b/src/DotNetOAuth/ChannelElements/PlainTextSigningBindingElement.cs
index 9cb052e..7ca5b7f 100644
--- a/src/DotNetOAuth/ChannelElements/PlainTextSigningBindingElement.cs
+++ b/src/DotNetOAuth/ChannelElements/PlainTextSigningBindingElement.cs
@@ -48,7 +48,7 @@ namespace DotNetOAuth.ChannelElements {
/// Clones this instance.
/// </summary>
/// <returns>A new instance of the binding element.</returns>
- protected override object Clone() {
+ protected override ITamperProtectionChannelBindingElement Clone() {
return new PlainTextSigningBindingElement();
}
}
diff --git a/src/DotNetOAuth/ChannelElements/RsaSha1SigningBindingElement.cs b/src/DotNetOAuth/ChannelElements/RsaSha1SigningBindingElement.cs
index e15f4b6..4862a54 100644
--- a/src/DotNetOAuth/ChannelElements/RsaSha1SigningBindingElement.cs
+++ b/src/DotNetOAuth/ChannelElements/RsaSha1SigningBindingElement.cs
@@ -8,6 +8,7 @@ namespace DotNetOAuth.ChannelElements {
using System;
using System.Security.Cryptography;
using System.Text;
+ using DotNetOAuth.Messaging;
/// <summary>
/// A binding element that signs outgoing messages and verifies the signature on incoming messages.
@@ -40,7 +41,7 @@ namespace DotNetOAuth.ChannelElements {
/// Clones this instance.
/// </summary>
/// <returns>A new instance of the binding element.</returns>
- protected override object Clone() {
+ protected override ITamperProtectionChannelBindingElement Clone() {
return new RsaSha1SigningBindingElement();
}
}
diff --git a/src/DotNetOAuth/ChannelElements/SigningBindingElementBase.cs b/src/DotNetOAuth/ChannelElements/SigningBindingElementBase.cs
index aa6f19f..7850bd8 100644
--- a/src/DotNetOAuth/ChannelElements/SigningBindingElementBase.cs
+++ b/src/DotNetOAuth/ChannelElements/SigningBindingElementBase.cs
@@ -54,8 +54,8 @@ namespace DotNetOAuth.ChannelElements {
/// <returns>
/// A new object that is a copy of this instance.
/// </returns>
- object ICloneable.Clone() {
- var clone = (SigningBindingElementBase)this.Clone();
+ ITamperProtectionChannelBindingElement ITamperProtectionChannelBindingElement.Clone() {
+ ITamperProtectionChannelBindingElement clone = this.Clone();
clone.SignatureVerificationCallback = this.SignatureVerificationCallback;
return clone;
}
@@ -179,7 +179,7 @@ namespace DotNetOAuth.ChannelElements {
/// Implementations of this method need not clone the SignatureVerificationCallback member, as the
/// <see cref="SigningBindingElementBase"/> class does this.
/// </remarks>
- protected abstract object Clone();
+ protected abstract ITamperProtectionChannelBindingElement Clone();
/// <summary>
/// Calculates a signature for a given message.
diff --git a/src/DotNetOAuth/ChannelElements/SigningBindingElementChain.cs b/src/DotNetOAuth/ChannelElements/SigningBindingElementChain.cs
index 9655f2c..dada28e 100644
--- a/src/DotNetOAuth/ChannelElements/SigningBindingElementChain.cs
+++ b/src/DotNetOAuth/ChannelElements/SigningBindingElementChain.cs
@@ -123,7 +123,7 @@ namespace DotNetOAuth.ChannelElements {
/// <returns>
/// A new object that is a copy of this instance.
/// </returns>
- object ICloneable.Clone() {
+ ITamperProtectionChannelBindingElement ITamperProtectionChannelBindingElement.Clone() {
return new SigningBindingElementChain(this.signers.Select(el => (ITamperProtectionChannelBindingElement)el.Clone()).ToArray());
}
diff --git a/src/DotNetOAuth/Messaging/ITamperProtectionChannelBindingElement.cs b/src/DotNetOAuth/Messaging/ITamperProtectionChannelBindingElement.cs
index cedd61c..b84b6e7 100644
--- a/src/DotNetOAuth/Messaging/ITamperProtectionChannelBindingElement.cs
+++ b/src/DotNetOAuth/Messaging/ITamperProtectionChannelBindingElement.cs
@@ -12,12 +12,18 @@ namespace DotNetOAuth.Messaging {
/// An interface that must be implemented by message transforms/validators in order
/// to be included in the channel stack.
/// </summary>
- public interface ITamperProtectionChannelBindingElement : IChannelBindingElement, ICloneable {
+ public interface ITamperProtectionChannelBindingElement : IChannelBindingElement {
/// <summary>
/// Gets or sets the delegate that will initialize the non-serialized properties necessary on a signed
/// message so that its signature can be correctly calculated for verification.
/// May be null for Consumers (who never have to verify signatures).
/// </summary>
Action<ITamperResistantOAuthMessage> SignatureVerificationCallback { get; set; }
+
+ /// <summary>
+ /// Clones this instance.
+ /// </summary>
+ /// <returns>The cloned instance.</returns>
+ ITamperProtectionChannelBindingElement Clone();
}
}