public async Task <string> StoreAsync(ServiceTicket ticket) { var holder = new ServiceTicketHolder(ticket); var value = Serialize(holder); await _cache.SetAsync( CacheKeyFactory(ticket.TicketId), value, new DistributedCacheEntryOptions { AbsoluteExpiration = ticket.Assertion.ValidUntil }).ConfigureAwait(false); return(ticket.TicketId); }
public async Task RenewAsync(string key, ServiceTicket ticket) { if (string.IsNullOrEmpty(key)) { throw new ArgumentNullException(nameof(key)); } var holder = new ServiceTicketHolder(ticket); var value = Serialize(holder); await _cache.RemoveAsync(CacheKeyFactory(key)).ConfigureAwait(false); await _cache.SetAsync(CacheKeyFactory(key), value, new DistributedCacheEntryOptions { AbsoluteExpiration = ticket.Assertion.ValidUntil }).ConfigureAwait(false); }