Exemple #1
0
        public UserStoreBase(AuthErrorDescriber describer)
        {
            if (describer == null)
            {
                throw new ArgumentNullException(nameof(describer));
            }

            ErrorDescriber = describer;
        }
Exemple #2
0
        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!");
                }
            }
        }
Exemple #3
0
 public PasswordValidator(AuthErrorDescriber errors = null)
 {
     Describer = errors ?? new AuthErrorDescriber();
 }
Exemple #4
0
 public UserValidator(AuthErrorDescriber errors = null)
 {
     Describer = errors ?? new AuthErrorDescriber();
 }