using CodeLiturgy.Data.Application.Users; using CodeLiturgy.Domain; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; namespace CodeLiturgy.Data.Auth.Context.Users { /// /// Users Repository /// public class UserRepository : UserStore { private readonly ApplicationUserDbContext _context; /// /// User repository /// /// /// public UserRepository(ApplicationUserDbContext context, IdentityErrorDescriber describer = null) : base(context, describer) { _context = context; } /// /// Get Application Users /// /// public async Task> GetUsers() { var users = await _context.Users.ToListAsync(); return users; } /// public override Task GetPasswordHashAsync(ApplicationUser user, CancellationToken cancellationToken = default) { if (cancellationToken.IsCancellationRequested) { return Task.FromCanceled(cancellationToken); } return Task.FromResult(user.PasswordHash); } /// public override Task HasPasswordAsync(ApplicationUser user, CancellationToken cancellationToken = default) { if (cancellationToken.IsCancellationRequested) { return Task.FromCanceled(cancellationToken); } return Task.FromResult(!string.IsNullOrEmpty(user.PasswordHash)); } } }