private async Task <TicketResult> RemoveAsync(AuthenticationTokenReceiveContext context) { TicketResult result = new TicketResult(); StoreKeyFunc = StoreKeyFunc ?? ((ctx, token) => token); string key = StoreKeyFunc(context.Ticket, context.Token); IDatabase database = _redis.GetDatabase(_configuration.Db); byte[] ticket = await database.StringGetAsync(key); if (ticket != null) { TicketSerializer serializer = new TicketSerializer(); result.Ticket = serializer.Deserialize(ticket); result.Deleted = await database.KeyDeleteAsync(key); } else { await database.KeyDeleteAsync(context.Token); } return(result); }
public void Receive(AuthenticationTokenReceiveContext context) { TicketResult result = Remove(context); if (result.Deleted) { context.SetTicket(result.Ticket); } }
public async Task ReceiveAsync(AuthenticationTokenReceiveContext context) { TicketResult result = await RemoveAsync(context); if (result.Deleted) { context.SetTicket(result.Ticket); } }
private TicketResult Remove(AuthenticationTokenReceiveContext context) { TicketResult result = new TicketResult(); RedisKeyGenerator = RedisKeyGenerator ?? ((ctx, token) => token); string key = RedisKeyGenerator(context.Ticket, context.Token); byte[] ticket = Db.StringGet(key); if (ticket.Length > default(int)) { TicketSerializer serializer = new TicketSerializer(); result.Ticket = serializer.Deserialize(ticket); result.Deleted = Db.KeyDelete(key); } return(result); }
private TicketResult Remove(AuthenticationTokenReceiveContext context) { TicketResult result = new TicketResult(); StoreKeyFunc = StoreKeyFunc ?? ((ctx, token) => token); string key = StoreKeyFunc(context.Ticket, context.Token); IDatabase database = _redis.GetDatabase(_configuration.Db); byte[] ticket = database.StringGet(key); if (ticket.Length > default(int)) { TicketSerializer serializer = new TicketSerializer(); result.Ticket = serializer.Deserialize(ticket); result.Deleted = database.KeyDelete(key); } return(result); }
private async Task <TicketResult> RemoveAsync(AuthenticationTokenReceiveContext context) { TicketResult result = new TicketResult(); RedisKeyGenerator = RedisKeyGenerator ?? ((ctx, token) => token); string key = RedisKeyGenerator(context.Ticket, context.Token); byte[] ticket = await Db.StringGetAsync(key); if (ticket != null) { TicketSerializer serializer = new TicketSerializer(); result.Ticket = serializer.Deserialize(ticket); result.Deleted = await Db.KeyDeleteAsync(key); } else { await Db.KeyDeleteAsync(context.Token); } return(result); }
private async Task<TicketResult> RemoveAsync(AuthenticationTokenReceiveContext context) { TicketResult result = new TicketResult(); StoreKeyFunc = StoreKeyFunc ?? ((ctx, token) => token); string key = StoreKeyFunc(context.Ticket, context.Token); IDatabase database = _redis.GetDatabase(_configuration.Db); byte[] ticket = await database.StringGetAsync(key); if (ticket != null) { TicketSerializer serializer = new TicketSerializer(); result.Ticket = serializer.Deserialize(ticket); result.Deleted = await database.KeyDeleteAsync(key); } else { await database.KeyDeleteAsync(context.Token); } return result; }
private TicketResult Remove(AuthenticationTokenReceiveContext context) { TicketResult result = new TicketResult(); StoreKeyFunc = StoreKeyFunc ?? ((ctx, token) => token); string key = StoreKeyFunc(context.Ticket, context.Token); IDatabase database = _redis.GetDatabase(_configuration.Db); byte[] ticket = database.StringGet(key); if (ticket.Length > default(int)) { TicketSerializer serializer = new TicketSerializer(); result.Ticket = serializer.Deserialize(ticket); result.Deleted = database.KeyDelete(key); } return result; }