public CustomUserManager(IUserStore <BaseUser> store, IOptions <IdentityOptions> optionsAccessor, IPasswordHasher <BaseUser> passwordHasher, IEnumerable <IUserValidator <BaseUser> > userValidators, IEnumerable <IPasswordValidator <BaseUser> > passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger <UserManager <BaseUser> > logger) : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger) { UserValidators.Clear(); UserValidators.Add(new CustomUserValidator()); }
public UserManager(IUserStore <TUser> store, IOptions <AuthOptions> options, IPasswordHasher <TUser> passwordHasher, IEnumerable <IUserValidator <TUser> > userValidators, IEnumerable <IPasswordValidator <TUser> > passwordValidators, AuthErrorDescriber errors, IServiceProvider services, ILogger <UserManager <TUser> > logger) { if (store == null) { throw new ArgumentNullException(nameof(store)); } Store = store; Options = options?.Value ?? new AuthOptions(); PasswordHasher = passwordHasher; ErrorDescriber = errors; Logger = logger; if (userValidators != null) { foreach (var v in userValidators) { UserValidators.Add(v); } } if (passwordValidators != null) { foreach (var v in passwordValidators) { PasswordValidators.Add(v); } } _services = services; if (Options.Stores.ProtectPersonalData) { if (!(Store is IProtectedUserStore <TUser>)) { throw new InvalidOperationException("Store is not a protected user store!"); } if (services.GetService <ILookupProtector>() == null) { throw new InvalidOperationException("There's no personal data protector!"); } } }