public void SaveRefreshToken(RefreshToken refreshToken) { if (_context.Tokens.Any(p => p.Token == refreshToken.Token)) { throw new ResourceAlreadyExistsException(); } _context.Add(refreshToken); _context.SaveChanges(); }
private static void Initialize(TokenStoreDbContext context) { var tokens = new[] { new RefreshToken { Id = Guid.Parse("4efb956c-a645-4480-9ed9-abc49acb55e0"), Token = Token, Revoked = false, UserName = "******", UserId = Guid.Parse("e2875b2c-faa6-4f40-8175-f2c6e565eb9a") }, new RefreshToken { Id = Guid.Parse("d155c5f0-255c-4e33-bd22-647f43f83f30"), Token = DifferentToken, Revoked = true, UserName = "******", UserId = Guid.Parse("f61c1af3-7755-4fdf-b1b7-c235c5b0193d") } }; context.Tokens.AddRange(tokens); context.SaveChanges(); }
public void UpdateRefreshToken(UserToken userToken) { tokenStoreDbContext.Update(userToken); tokenStoreDbContext.SaveChanges(); }