summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1PlainTextMessageHandler.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2013-03-26 11:19:06 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2013-03-26 11:19:06 -0700
commit3d37ff45cab6838d80b22e6b782a0b9b4c2f4aeb (patch)
treec15816c3d7f6e74334553f2ff98605ce1c22c538 /src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1PlainTextMessageHandler.cs
parent5e9014f36b2d53b8e419918675df636540ea24e2 (diff)
parente6f7409f4caceb7bc2a5b4ddbcb1a4097af340f2 (diff)
downloadDotNetOpenAuth-3d37ff45cab6838d80b22e6b782a0b9b4c2f4aeb.zip
DotNetOpenAuth-3d37ff45cab6838d80b22e6b782a0b9b4c2f4aeb.tar.gz
DotNetOpenAuth-3d37ff45cab6838d80b22e6b782a0b9b4c2f4aeb.tar.bz2
Move to HttpClient throughout library.
Diffstat (limited to 'src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1PlainTextMessageHandler.cs')
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1PlainTextMessageHandler.cs59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1PlainTextMessageHandler.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1PlainTextMessageHandler.cs
new file mode 100644
index 0000000..b2e13d6
--- /dev/null
+++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1PlainTextMessageHandler.cs
@@ -0,0 +1,59 @@
+//-----------------------------------------------------------------------
+// <copyright file="OAuth1PlainTextMessageHandler.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth.OAuth {
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.Specialized;
+ using System.Linq;
+ using System.Text;
+ using System.Threading.Tasks;
+ using DotNetOpenAuth.Messaging;
+
+ /// <summary>
+ /// A delegating HTTP handler that signs outgoing HTTP requests
+ /// with the PLAINTEXT signature.
+ /// </summary>
+ public class OAuth1PlainTextMessageHandler : OAuth1HttpMessageHandlerBase {
+ /// <summary>
+ /// Gets the signature method to include in the oauth_signature_method parameter.
+ /// </summary>
+ /// <value>
+ /// The signature method.
+ /// </value>
+ protected override string SignatureMethod {
+ get { return "PLAINTEXT"; }
+ }
+
+ /// <summary>
+ /// Calculates the signature for the specified buffer.
+ /// </summary>
+ /// <param name="signedPayload">The payload to calculate the signature for.</param>
+ /// <returns>
+ /// The signature.
+ /// </returns>
+ /// <exception cref="System.NotImplementedException">Always thrown.</exception>
+ protected override byte[] Sign(byte[] signedPayload) {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Gets the OAuth 1.0 signature to apply to the specified request.
+ /// </summary>
+ /// <param name="request">The outbound HTTP request.</param>
+ /// <param name="oauthParameters">The oauth parameters.</param>
+ /// <returns>
+ /// The value for the "oauth_signature" parameter.
+ /// </returns>
+ protected override string GetSignature(System.Net.Http.HttpRequestMessage request, NameValueCollection oauthParameters) {
+ var builder = new StringBuilder();
+ builder.Append(MessagingUtilities.EscapeUriDataStringRfc3986(this.ConsumerSecret));
+ builder.Append("&");
+ builder.Append(MessagingUtilities.EscapeUriDataStringRfc3986(this.AccessTokenSecret));
+ return builder.ToString();
+ }
+ }
+}