//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Collections.Generic; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; using Validation; /// /// Provides association serialization and deserialization. /// /// /// Implementations may choose to store the association details in memory or a database table and simply return a /// short, randomly generated string that is the key to that data. Alternatively, an implementation may /// sign and encrypt the association details and then encode the results as a base64 string and return that value /// as the association handle, thereby avoiding any association persistence at the OpenID Provider. /// When taking the latter approach however, it is of course imperative that the association be encrypted /// to avoid disclosing the secret to anyone who sees the association handle, which itself isn't considered to /// be confidential. /// internal interface IProviderAssociationStore { /// /// Stores an association and returns a handle for it. /// /// The association secret. /// The UTC time that the association should expire. /// A value indicating whether this is a private association. /// /// The association handle that represents this association. /// string Serialize(byte[] secret, DateTime expiresUtc, bool privateAssociation); /// /// Retrieves an association given an association handle. /// /// The OpenID message that referenced this association handle. /// A value indicating whether a private association is expected. /// The association handle. /// /// An association instance, or null if the association has expired or the signature is incorrect (which may be because the OP's symmetric key has changed). /// /// Thrown if the association is not of the expected type. Association Deserialize(IProtocolMessage containingMessage, bool privateAssociation, string handle); } }