using System; using System.Collections.Generic; using System.Text; namespace DotNetOpenId.Extensions { /// /// The contract any OpenID extension for DotNetOpenId must implement. /// public interface IExtension { /// /// Gets the TypeURI the extension uses in the OpenID protocol and in XRDS advertisements. /// string TypeUri { get; } /// /// 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; } } /// /// The contract an OpenID extension can implement for messages from relying party to provider /// to make handling extensions generally easier. /// Extensions are not required to implement this interface, however. /// public interface IExtensionRequest : IExtension { /// /// Returns the fields this extension should add to an authentication request. /// IDictionary Serialize(RelyingParty.IAuthenticationRequest authenticationRequest); /// /// Reads the extension information on an authentication request to the provider. /// /// The fields belonging to the extension. /// The incoming OpenID request carrying the extension. /// The actual extension TypeUri that was recognized in the message. /// /// True if the extension found a valid set of recognized parameters in the request, /// false otherwise. /// bool Deserialize(IDictionary fields, Provider.IRequest request, string typeUri); } /// /// The contract an OpenID extension can implement for messages from provider to relying party /// to make handling extensions generally easier. /// Extensions are not required to implement this interface, however. /// public interface IExtensionResponse : IExtension { /// /// Returns the fields this extension should add to an authentication response. /// IDictionary Serialize(Provider.IRequest authenticationRequest); /// /// Reads a Provider's response for extension values. /// /// The fields belonging to the extension. /// The incoming OpenID response carrying the extension. /// The actual extension TypeUri that was recognized in the message. /// /// True if the extension found a valid set of recognized parameters in the response, /// false otherwise. /// bool Deserialize(IDictionary fields, RelyingParty.IAuthenticationResponse response, string typeUri); } }