コード例 #1
0
 public ApplicationUserManager(
     IApplicationUserStore store,
     IOptions <IdentityOptions> optionsAccessor,
     IPasswordHasher <User> passwordHasher,
     IEnumerable <IUserValidator <User> > userValidators,
     IEnumerable <IPasswordValidator <User> > passwordValidators,
     ILookupNormalizer keyNormalizer,
     IdentityErrorDescriber errors,
     IServiceProvider services,
     ILogger <ApplicationUserManager> logger,
     IHttpContextAccessor contextAccessor,
     IUnitOfWork uow,
     IUsedPasswordsService usedPasswordsService)
     : base(
         (UserStore <User, Role, ApplicationDbContext, int, UserClaim, UserRole, UserLogin, UserToken, RoleClaim>)store,
         optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger)
 {
     _userStore          = store ?? throw new ArgumentNullException(nameof(_userStore));
     _optionsAccessor    = optionsAccessor ?? throw new ArgumentNullException(nameof(_optionsAccessor));
     _passwordHasher     = passwordHasher ?? throw new ArgumentNullException(nameof(_passwordHasher));
     _userValidators     = userValidators ?? throw new ArgumentNullException(nameof(_userValidators));
     _passwordValidators = passwordValidators ?? throw new ArgumentNullException(nameof(_passwordValidators));
     _keyNormalizer      = keyNormalizer ?? throw new ArgumentNullException(nameof(_keyNormalizer));
     _errors             = errors ?? throw new ArgumentNullException(nameof(_errors));
     _services           = services ?? throw new ArgumentNullException(nameof(_services));
     _logger             = logger ?? throw new ArgumentNullException(nameof(_logger));
     _contextAccessor    = contextAccessor ?? throw new ArgumentNullException(nameof(_contextAccessor));
     _uow = uow ?? throw new ArgumentNullException(nameof(_uow));
     _usedPasswordsService = usedPasswordsService ?? throw new ArgumentNullException(nameof(_usedPasswordsService));
     _users = uow.Set <User>();
     _roles = uow.Set <Role>();
 }
コード例 #2
0
        public ApplicationUserManager(IApplicationUserStore store,
                                      IOptions <IdentityOptions> optionsAccessor,
                                      IPasswordHasher <User> passwordHasher,
                                      IEnumerable <IUserValidator <User> > userValidators,
                                      IEnumerable <IPasswordValidator <User> > passwordValidators,
                                      ILookupNormalizer keyNormalizer,
                                      IdentityErrorDescriber errors,
                                      IServiceProvider services,
                                      ILogger <UserManager <User> > logger,
                                      IUnitOfWork uow,
                                      IHttpContextAccessor contextAccessor)
            : base((UserStore <User, Role, AppDbContext, Guid, UserClaim, UserRole, UserLogin, UserToken, RoleClaim>)store,
                   optionsAccessor,
                   passwordHasher,
                   userValidators,
                   passwordValidators,
                   keyNormalizer,
                   errors,
                   services,
                   logger)
        {
            _uow = uow;
            _uow.CheckArgumentIsNull(nameof(_uow));

            _contextAccessor = contextAccessor;
            _contextAccessor.CheckArgumentIsNull(nameof(_contextAccessor));

            _users = uow.Set <User>();
        }
コード例 #3
0
        public IdentityApplicationUserStore(IApplicationUserStore userStore)
        {
            if (userStore == null)
            {
                throw new ArgumentNullException(nameof(userStore));
            }

            _userStore = userStore;
        }
コード例 #4
0
        public ApplicationUserManager(
            IApplicationUserStore store,
            IOptions <IdentityOptions> optionsAccessor,
            IPasswordHasher <User> passwordHasher,
            IEnumerable <IUserValidator <User> > userValidators,
            IEnumerable <IPasswordValidator <User> > passwordValidators,
            ILookupNormalizer keyNormalizer,
            IdentityErrorDescriber errors,
            IServiceProvider services,
            ILogger <ApplicationUserManager> logger,
            IHttpContextAccessor contextAccessor,
            IUnitOfWork uow,
            IUsedPasswordsService usedPasswordsService)
            : base((UserStore <User, Role, ApplicationDbContext, int, UserClaim, UserRole, UserLogin, UserToken, RoleClaim>)store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger)
        {
            //  _userStore = store;
            store.CheckArgumentIsNull(nameof(store));

            //  _optionsAccessor = optionsAccessor;
            optionsAccessor.CheckArgumentIsNull(nameof(optionsAccessor));

            // _passwordHasher = passwordHasher;
            passwordHasher.CheckArgumentIsNull(nameof(passwordHasher));

            //  _userValidators = userValidators;
            userValidators.CheckArgumentIsNull(nameof(userValidators));

            // _passwordValidators = passwordValidators;
            passwordValidators.CheckArgumentIsNull(nameof(passwordValidators));

            //_keyNormalizer = keyNormalizer;
            keyNormalizer.CheckArgumentIsNull(nameof(keyNormalizer));

            //_errors = errors;
            errors.CheckArgumentIsNull(nameof(errors));

            // _services = services;
            services.CheckArgumentIsNull(nameof(services));

            //_logger = logger;
            logger.CheckArgumentIsNull(nameof(logger));

            _contextAccessor = contextAccessor;
            _contextAccessor.CheckArgumentIsNull(nameof(_contextAccessor));

            // _uow = uow;
            uow.CheckArgumentIsNull(nameof(uow));

            _usedPasswordsService = usedPasswordsService;
            _usedPasswordsService.CheckArgumentIsNull(nameof(_usedPasswordsService));

            _users = uow.Set <User>();
            _roles = uow.Set <Role>();
        }
コード例 #5
0
        public ApplicationUserManager(IApplicationUserStore store)
            : base((IUserStore<ApplicationUser>)store)
        {

              this.UserValidator =    new ApplicationUserValidator(this)
              {
                  AllowOnlyAlphanumericUserNames = false,
                 RequireUniqueEmail = true
              };
           
            // Configure validation logic for passwords
            this.PasswordValidator = new PasswordValidator
            {
                RequiredLength = 6,
                RequireNonLetterOrDigit = false,
                RequireDigit = false,
                RequireLowercase = false,
                RequireUppercase = false,
            };

            // Configure user lockout defaults
            this.UserLockoutEnabledByDefault = true;
            this.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5);
            this.MaxFailedAccessAttemptsBeforeLockout = 5;

            // Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
            // You can write your own provider and plug it in here.
            this.RegisterTwoFactorProvider("Phone Code", (IUserTokenProvider<ApplicationUser, string>)new PhoneNumberModelTokenManagementServiceProvider()
            {
                MessageFormat = "Your security code is {0}"
            });

            this.RegisterTwoFactorProvider("Email Code", (IUserTokenProvider<ApplicationUser, string>)new EmailModelTokenManegementServiceProvider()
            {
                Subject = "Security Code",
                BodyFormat = "Your security code is {0}"
            });
            this.EmailService = new EmailManagementServices();
            this.SmsService = new SmsManagementServices();

            var dataProtectionProvider = Startup.DataProtectionProvider;
            if (dataProtectionProvider != null)
            {
                IDataProtector dataProtector = dataProtectionProvider.Create("ASP.NET Identity");

                this.UserTokenProvider = new DataProtectorTokenProvider<ApplicationUser>(dataProtector);
            }
        }
コード例 #6
0
 public ApplicationUserManager(IApplicationUserStore store)
 {
     Store = store ?? throw new ArgumentNullException(nameof(store));
 }
コード例 #7
0
 public UserController(IApplicationUserStore userStore)
 {
     _userStore = userStore;
 }
コード例 #8
0
 public ApplicationUserManager(IApplicationUserStore store)
     : base(store)
 {
 }
コード例 #9
0
 public EnhancedApplicationUserManager(IApplicationUserStore store) : base(store)
 {
     this.store = store;
 }
コード例 #10
0
 public ApplicationUserManager(IApplicationUserStore store, IOptions <IdentityOptions> optionsAccessor, IPasswordHasher <ApplicationUser> passwordHasher, IEnumerable <IUserValidator <ApplicationUser> > userValidators, IEnumerable <IPasswordValidator <ApplicationUser> > passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger <UserManager <ApplicationUser> > logger) : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger)
 {
     this.store = store;
 }
コード例 #11
0
 public ApplicationUserManager(IApplicationUserStore store, IPasswordHasher hasher) : base((ApplicationUserStore)store)
 {
     PasswordHasher = hasher;
 }