Exemplo n.º 1
0
        public async Task <bool> AddRefreshToken(Framework.TokenAuth.Entities.RefreshToken token)
        {
            var existingToken = _ctx.RefreshTokens.Where(r => r.Subject == token.Subject && r.ClientId == token.ClientId).SingleOrDefault();

            if (existingToken != null)
            {
                var result = await RemoveRefreshToken(existingToken);
            }

            _ctx.RefreshTokens.Add(token);

            return(await _ctx.SaveChangesAsync() > 0);
        }
Exemplo n.º 2
0
 public async Task <bool> RemoveRefreshToken(Framework.TokenAuth.Entities.RefreshToken refreshToken)
 {
     _ctx.RefreshTokens.Remove(refreshToken);
     return(await _ctx.SaveChangesAsync() > 0);
 }