//-----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------
namespace System.IdentityModel.Tokens
{
using System.Collections.Generic;
using System.IdentityModel.Configuration;
using System.Xml;
///
/// Defines a simple interface to a cache of security tokens.
///
public abstract class SessionSecurityTokenCache : ICustomIdentityConfiguration
{
///
/// Load custom configuration from Xml
///
/// Custom configuration elements
public virtual void LoadCustomConfiguration(XmlNodeList nodelist)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException(SR.GetString(SR.ID0023, this.GetType().AssemblyQualifiedName)));
}
///
/// Attempts to add an entry to the cache or update an existing one.
///
/// The key of the entry to be added.
/// The associated SessionSecurityToken to be added.
/// The expiration time of the entry.
public abstract void AddOrUpdate(SessionSecurityTokenCacheKey key, SessionSecurityToken value, DateTime expiryTime);
///
/// Retrieves all tokens associated with a given key.
///
/// The endpointId to search for.
/// The contextId to search for.
/// In the derived class returns, the collection of tokens associated with the key.
public abstract IEnumerable GetAll(string endpointId, System.Xml.UniqueId contextId);
///
/// Attempts to retrieve an entry from the cache.
///
/// The key of the entry to be retrieved.
/// The SessionSecurityToken associated with the input key, null if not match is found.
public abstract SessionSecurityToken Get(SessionSecurityTokenCacheKey key);
///
/// Attempts to remove all matching entries from cache.
///
/// The endpoint id for the entry to be removed.
/// The context Id for the entry to be removed.
public abstract void RemoveAll(string endpointId, System.Xml.UniqueId contextId);
///
/// Attempts to remove all entries with a matching endpoint Id from the cache.
///
/// The endpoint id for the entry to be removed.
public abstract void RemoveAll(string endpointId);
///
/// Attempts to remove an entry from the cache.
///
/// The key of the entry to be removed.
public abstract void Remove(SessionSecurityTokenCacheKey key);
}
}