//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.OpenId.Messages { using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; /// /// The contract any OpenID extension for DotNetOpenAuth must implement. /// /// /// Classes that implement this interface should be marked as /// [] to allow serializing state servers /// to cache messages, particularly responses. /// [ContractClass(typeof(IOpenIdMessageExtensionContract))] public interface IOpenIdMessageExtension : IExtensionMessage { /// /// Gets the TypeURI the extension uses in the OpenID protocol and in XRDS advertisements. /// string TypeUri { get; } /// /// Gets the additional TypeURIs that are supported by this extension, in preferred order. /// May be empty if none other than is supported, but /// should not be null. /// /// /// Useful for reading in messages with an older version of an extension. /// The value in the property is always checked before /// trying this list. /// If you do support multiple versions of an extension using this method, /// consider adding a CreateResponse method to your request extension class /// so that the response can have the context it needs to remain compatible /// given the version of the extension in the request message. /// The for an example. /// IEnumerable AdditionalSupportedTypeUris { get; } /// /// Gets or sets a value indicating whether this extension was /// signed by the sender. /// /// /// true if this instance is signed by the sender; otherwise, false. /// bool IsSignedByRemoteParty { get; set; } } /// /// Code contract class for the IOpenIdMessageExtension interface. /// [ContractClassFor(typeof(IOpenIdMessageExtension))] internal abstract class IOpenIdMessageExtensionContract : IOpenIdMessageExtension { /// /// Prevents a default instance of the class from being created. /// private IOpenIdMessageExtensionContract() { } #region IOpenIdMessageExtension Members /// /// Gets the TypeURI the extension uses in the OpenID protocol and in XRDS advertisements. /// string IOpenIdMessageExtension.TypeUri { get { Contract.Ensures(!string.IsNullOrEmpty(Contract.Result())); throw new NotImplementedException(); } } /// /// Gets the additional TypeURIs that are supported by this extension, in preferred order. /// May be empty if none other than is supported, but /// should not be null. /// /// /// Useful for reading in messages with an older version of an extension. /// The value in the property is always checked before /// trying this list. /// If you do support multiple versions of an extension using this method, /// consider adding a CreateResponse method to your request extension class /// so that the response can have the context it needs to remain compatible /// given the version of the extension in the request message. /// The for an example. /// IEnumerable IOpenIdMessageExtension.AdditionalSupportedTypeUris { get { Contract.Ensures(Contract.Result>() != null); throw new NotImplementedException(); } } /// /// Gets or sets a value indicating whether this extension was /// signed by the sender. /// /// /// true if this instance is signed by the sender; otherwise, false. /// bool IOpenIdMessageExtension.IsSignedByRemoteParty { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } #endregion #region IMessage Members /// /// Gets the version of the protocol or extension this message is prepared to implement. /// /// /// Implementations of this interface should ensure that this property never returns null. /// Version IMessage.Version { get { throw new NotImplementedException(); } } /// /// Gets the extra, non-standard Protocol parameters included in the message. /// /// /// Implementations of this interface should ensure that this property never returns null. /// IDictionary IMessage.ExtraData { get { throw new NotImplementedException(); } } /// /// Checks the message state for conformity to the protocol specification /// and throws an exception if the message is invalid. /// /// /// Some messages have required fields, or combinations of fields that must relate to each other /// in specialized ways. After deserializing a message, this method checks the state of the /// message to see if it conforms to the protocol. /// Note that this property should not check signatures or perform any state checks /// outside this scope of this particular message. /// /// Thrown if the message is invalid. void IMessage.EnsureValidMessage() { throw new NotImplementedException(); } #endregion } }