Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public void Receive(AuthenticationTokenReceiveContext context)
        {
            TicketResult result = Remove(context);

            if (result.Deleted)
            {
                context.SetTicket(result.Ticket);
            }
        }
Ejemplo n.º 3
0
        public async Task ReceiveAsync(AuthenticationTokenReceiveContext context)
        {
            TicketResult result = await RemoveAsync(context);

            if (result.Deleted)
            {
                context.SetTicket(result.Ticket);
            }
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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;
        }