summaryrefslogtreecommitdiffstats
path: root/src/DotNetOAuth.Test/OAuth/ChannelElements/PlaintextSigningBindingElementTest.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2008-11-03 17:22:00 -0800
committerAndrew <andrewarnott@gmail.com>2008-11-04 08:12:52 -0800
commit462e19abd9034c11a12cad30e9899740f2bef8ff (patch)
treee08667f1d69249f8daa6c348a919bd0fd5434415 /src/DotNetOAuth.Test/OAuth/ChannelElements/PlaintextSigningBindingElementTest.cs
parent6a79be0eca3929d8fb4e797799dac8d6f7875475 (diff)
downloadDotNetOpenAuth-462e19abd9034c11a12cad30e9899740f2bef8ff.zip
DotNetOpenAuth-462e19abd9034c11a12cad30e9899740f2bef8ff.tar.gz
DotNetOpenAuth-462e19abd9034c11a12cad30e9899740f2bef8ff.tar.bz2
Changed namepace and project names in preparation for merge with DotNetOpenId.
Diffstat (limited to 'src/DotNetOAuth.Test/OAuth/ChannelElements/PlaintextSigningBindingElementTest.cs')
-rw-r--r--src/DotNetOAuth.Test/OAuth/ChannelElements/PlaintextSigningBindingElementTest.cs78
1 files changed, 0 insertions, 78 deletions
diff --git a/src/DotNetOAuth.Test/OAuth/ChannelElements/PlaintextSigningBindingElementTest.cs b/src/DotNetOAuth.Test/OAuth/ChannelElements/PlaintextSigningBindingElementTest.cs
deleted file mode 100644
index 151f00d..0000000
--- a/src/DotNetOAuth.Test/OAuth/ChannelElements/PlaintextSigningBindingElementTest.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="PlaintextSigningBindingElementTest.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOAuth.Test.OAuth.ChannelElements
-{
- using DotNetOAuth.Messaging;
- using DotNetOAuth.OAuth.ChannelElements;
- using DotNetOAuth.OAuth.Messages;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
-
- [TestClass]
- public class PlaintextSigningBindingElementTest {
- [TestMethod]
- public void HttpsSignatureGeneration() {
- SigningBindingElementBase target = new PlaintextSigningBindingElement();
- MessageReceivingEndpoint endpoint = new MessageReceivingEndpoint("https://localtest", HttpDeliveryMethods.GetRequest);
- ITamperResistantOAuthMessage message = new UnauthorizedTokenRequest(endpoint);
- message.ConsumerSecret = "cs";
- message.TokenSecret = "ts";
- Assert.IsTrue(target.PrepareMessageForSending(message));
- Assert.AreEqual("PLAINTEXT", message.SignatureMethod);
- Assert.AreEqual("cs&ts", message.Signature);
- }
-
- [TestMethod]
- public void HttpsSignatureVerification() {
- MessageReceivingEndpoint endpoint = new MessageReceivingEndpoint("https://localtest", HttpDeliveryMethods.GetRequest);
- ITamperProtectionChannelBindingElement target = new PlaintextSigningBindingElement();
- ITamperResistantOAuthMessage message = new UnauthorizedTokenRequest(endpoint);
- message.ConsumerSecret = "cs";
- message.TokenSecret = "ts";
- message.SignatureMethod = "PLAINTEXT";
- message.Signature = "cs&ts";
- Assert.IsTrue(target.PrepareMessageForReceiving(message));
- }
-
- [TestMethod]
- public void HttpsSignatureVerificationNotApplicable() {
- SigningBindingElementBase target = new PlaintextSigningBindingElement();
- MessageReceivingEndpoint endpoint = new MessageReceivingEndpoint("https://localtest", HttpDeliveryMethods.GetRequest);
- ITamperResistantOAuthMessage message = new UnauthorizedTokenRequest(endpoint);
- message.ConsumerSecret = "cs";
- message.TokenSecret = "ts";
- message.SignatureMethod = "ANOTHERALGORITHM";
- message.Signature = "somethingelse";
- Assert.IsFalse(target.PrepareMessageForReceiving(message), "PLAINTEXT binding element should opt-out where it doesn't understand.");
- }
-
- [TestMethod]
- public void HttpSignatureGeneration() {
- SigningBindingElementBase target = new PlaintextSigningBindingElement();
- MessageReceivingEndpoint endpoint = new MessageReceivingEndpoint("http://localtest", HttpDeliveryMethods.GetRequest);
- ITamperResistantOAuthMessage message = new UnauthorizedTokenRequest(endpoint);
- message.ConsumerSecret = "cs";
- message.TokenSecret = "ts";
-
- // Since this is (non-encrypted) HTTP, so the plain text signer should not be used
- Assert.IsFalse(target.PrepareMessageForSending(message));
- Assert.IsNull(message.SignatureMethod);
- Assert.IsNull(message.Signature);
- }
-
- [TestMethod]
- public void HttpSignatureVerification() {
- SigningBindingElementBase target = new PlaintextSigningBindingElement();
- MessageReceivingEndpoint endpoint = new MessageReceivingEndpoint("http://localtest", HttpDeliveryMethods.GetRequest);
- ITamperResistantOAuthMessage message = new UnauthorizedTokenRequest(endpoint);
- message.ConsumerSecret = "cs";
- message.TokenSecret = "ts";
- message.SignatureMethod = "PLAINTEXT";
- message.Signature = "cs%26ts";
- Assert.IsFalse(target.PrepareMessageForReceiving(message), "PLAINTEXT signature binding element should refuse to participate in non-encrypted messages.");
- }
- }
-}