You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

26 lines
1.1 KiB

using Easy.AuthorityManagement.Clean.Shared.Consts;
using Easy.AuthorityManagement.Clean.Shared.IServices;
using Easy.DDD.Domain;
namespace Easy.AuthorityManagement.Clean.Domain.Services;
public class IdentityUserManager : DomainService, IIdentityUserManager
{
protected IPermissionGrantManager PermissionGrantManager => LazyServiceProvider.LazyGetService<IPermissionGrantManager>();
protected IRepository<IdentityUser> IdentityUserRepository { get; }
public IdentityUserManager(IRepository<IdentityUser> identityUserRepository)
{
IdentityUserRepository = identityUserRepository;
}
public async Task<IdentityUser> PasswordSignInAsync(string accout, string passwordHash)
{
When.Is(string.IsNullOrEmpty(accout), LoginResultConst.UserNameNotNullError);
When.Is(string.IsNullOrEmpty(passwordHash), LoginResultConst.PassWordNotNullError);
var identityUser = await IdentityUserRepository.Set
.FirstOrDefaultAsync(o => o.UserAccount == accout && o.PasswordHash == passwordHash);
When.Is(identityUser == null, LoginResultConst.PassWordLoginError);
return identityUser;
}
}