protected override void OnTokenAdded(IssuedTokenCacheBase.Key key, GenericXmlSecurityToken token) { using (FileStream fileStream = File.Open(this.fileName, FileMode.Append, FileAccess.Write)) { fileStream.Seek(0L, SeekOrigin.End); FileIssuedTokenCache.SerializeCachedToken(fileStream, key.Target, key.Issuer, token); } }
protected override void OnTokenRemoved(IssuedTokenCacheBase.Key key) { using (FileStream fileStream = File.Open(this.fileName, FileMode.Append, FileAccess.Write)) { fileStream.Seek(0L, SeekOrigin.Begin); foreach (IssuedTokenCacheBase.Key key2 in base.Cache.Keys) { GenericXmlSecurityToken token = base.Cache[key2]; FileIssuedTokenCache.SerializeCachedToken(fileStream, key.Target, key.Issuer, token); } } }
public FileIssuedTokenCache(string fileName) { this.fileName = fileName; if (File.Exists(fileName)) { using (FileStream fileStream = File.Open(fileName, FileMode.OpenOrCreate, FileAccess.Read)) { fileStream.Seek(0L, SeekOrigin.Begin); FileIssuedTokenCache.PopulateCache(base.Cache, fileStream); } } }