//----------------------------------------------------------------------- // // Copyright (c) Andrew Arnott. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOAuth.ChannelElements { using System; using System.Collections.Generic; using System.Linq; using System.Text; using DotNetOAuth.Messaging; using DotNetOAuth.Messaging.Bindings; /// /// A binding element that signs outgoing messages and verifies the signature on incoming messages. /// public class PlaintextSigningBindingElement : SigningBindingElementBase { /// /// Initializes a new instance of the class. /// public PlaintextSigningBindingElement() : base("PLAINTEXT") { } /// /// Calculates a signature for a given message. /// /// The message to sign. /// The signature for the message. /// /// This method signs the message according to OAuth 1.0 section 9.4.1. /// protected override string GetSignature(ITamperResistantOAuthMessage message) { return GetConsumerAndTokenSecretString(message); } /// /// Checks whether this binding element applies to this message. /// /// The message that needs to be signed. /// True if this binding element can be used to sign the message. False otherwise. protected override bool IsMessageApplicable(ITamperResistantOAuthMessage message) { return string.Equals(message.Recipient.Scheme, "https", StringComparison.OrdinalIgnoreCase); } /// /// Clones this instance. /// /// A new instance of the binding element. protected override ITamperProtectionChannelBindingElement Clone() { return new PlaintextSigningBindingElement(); } } }