Esempio n. 1
0
 public async Task<bool> RemoveRefreshToken(RefreshToken refreshToken)
 {
     _ctx.RefreshTokens.Remove(refreshToken);
      return await _ctx.SaveChangesAsync() > 0;
 }
Esempio n. 2
0
        public async Task<bool> AddRefreshToken(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;
        }