Пример #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, long, UserClaim, UserRole, UserLogin, UserToken, RoleClaim>)store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger)
        {
            _userStore = store;
            _userStore.CheckArgumentIsNull(nameof(_userStore));

            _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>();
            _userRoles = uow.Set <UserRole>();
        }
Пример #2
0
        public AntiForgeryCookieService(IHttpContextAccessor contextAccessor, IAntiforgery antiforgery, IOptions <AntiforgeryOptions> antiforgeryOptions)
        {
            _contextAccessor = contextAccessor;
            _contextAccessor.CheckArgumentIsNull(nameof(contextAccessor));

            _antiforgery = antiforgery;
            _antiforgery.CheckArgumentIsNull(nameof(antiforgery));

            _antiforgeryOptions = antiforgeryOptions;
            _antiforgeryOptions.CheckArgumentIsNull(nameof(antiforgeryOptions));
        }
Пример #3
0
        public DbLoggerProvider(
            IOptions <SiteSettings> siteSettings,
            IServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;
            _serviceProvider.CheckArgumentIsNull(nameof(_serviceProvider));

            _siteSettings = siteSettings;
            _siteSettings.CheckArgumentIsNull(nameof(_siteSettings));

            _outputTask = Task.Run(processLogQueue);
        }
Пример #4
0
        public RequestResponseLoggingMiddleware(RequestDelegate next, IOptions <SiteSettings> siteSettings, IBackgroundTaskQueue backgroundTaskQueue, ILogger <RequestResponseLoggingMiddleware> logger)
        {
            _next = next;
            _next.CheckArgumentIsNull(nameof(_next));

            _siteSettings = siteSettings;
            _siteSettings.CheckArgumentIsNull(nameof(_siteSettings));

            _backgroundTaskQueue = backgroundTaskQueue;
            _backgroundTaskQueue.CheckArgumentIsNull(nameof(_backgroundTaskQueue));

            _logger = logger;
            _logger.CheckArgumentIsNull(nameof(_logger));
        }
Пример #5
0
        //private readonly IOptions<IdentityOptions> _optionsAccessor;
        //private readonly IApplicationRoleManager _roleManager;
        //private readonly IApplicationUserManager _userManager;

        public ApplicationClaimsPrincipalFactory(
            IApplicationUserManager userManager,
            IApplicationRoleManager roleManager,
            IOptions <IdentityOptions> optionsAccessor)
            : base((UserManager <User>)userManager, (RoleManager <Role>)roleManager, optionsAccessor)
        {
            userManager.CheckArgumentIsNull(nameof(userManager));

            // _roleManager = roleManager;
            roleManager.CheckArgumentIsNull(nameof(roleManager));

            //_optionsAccessor = optionsAccessor;
            optionsAccessor.CheckArgumentIsNull(nameof(optionsAccessor));
        }
        public CustomSecurityStampValidator(
            IOptions <IdentityOptions> options,
            IApplicationSignInManager signInManager,
            ISiteStatService siteStatService)
            : base(options, (SignInManager <User>)signInManager)
        {
            _options = options;
            _options.CheckArgumentIsNull(nameof(_options));

            _signInManager = signInManager;
            _signInManager.CheckArgumentIsNull(nameof(_signInManager));

            _siteStatService = siteStatService;
            _siteStatService.CheckArgumentIsNull(nameof(_siteStatService));
        }
Пример #7
0
        public CustomClaimsPrincipalFactory(
            IUserService userService,
            IRoleService roleService,
            IOptions <IdentityOptions> optionsAccessor)
            : base((UserManager <User>)userService, (RoleManager <Role>)roleService, optionsAccessor)
        {
            _userService = userService;
            _userService.CheckArgumentIsNull(nameof(_userService));

            _roleService = roleService;
            _roleService.CheckArgumentIsNull(nameof(_roleService));

            _optionsAccessor = optionsAccessor;
            _optionsAccessor.CheckArgumentIsNull(nameof(_optionsAccessor));
        }
Пример #8
0
        public DbLogger(
            DbLoggerProvider loggerProvider,
            IServiceProvider serviceProvider,
            string loggerName,
            IOptions <SiteSettings> siteSettings)
        {
            _loggerName = loggerName;

            _siteSettings = siteSettings;
            _siteSettings.CheckArgumentIsNull(nameof(_siteSettings));
            _minLevel = _siteSettings.Value.Logging.LogLevel.Default;

            _serviceProvider = serviceProvider;
            _serviceProvider.CheckArgumentIsNull(nameof(_serviceProvider));

            _loggerProvider = loggerProvider;
            _loggerProvider.CheckArgumentIsNull(nameof(_loggerProvider));
        }
Пример #9
0
        public CustomSecurityStampValidator(
            IOptions <SecurityStampValidatorOptions> options,
            IApplicationSignInManager signInManager,
            ISystemClock clock,
            ISiteStatService siteStatService,
            ILoggerFactory loggerFactory)
            : base(options, (SignInManager <User>)signInManager, clock, loggerFactory)
        {
            _options = options;
            _options.CheckArgumentIsNull(nameof(_options));

            _signInManager = signInManager;
            _signInManager.CheckArgumentIsNull(nameof(_signInManager));

            _siteStatService = siteStatService;
            _siteStatService.CheckArgumentIsNull(nameof(_siteStatService));

            _clock = clock;
        }
        public CustomSecurityStampValidator(
            IOptions <SecurityStampValidatorOptions> options,
            ISignInService signInService,
            IUserService userService,
            ISystemClock systemClock,
            ISiteStateService siteStateService)
            : base(options, (SignInManager <User>)signInService, systemClock)
        {
            _options = options;
            _options.CheckArgumentIsNull(nameof(_options));

            _signInService = signInService;
            _userService   = userService;
            _signInService.CheckArgumentIsNull(nameof(_signInService));

            _siteStateService = siteStateService;
            _siteStateService.CheckArgumentIsNull(nameof(_siteStateService));

            _systemClock = systemClock;
        }
        public ApplicationSignInManager(
            IApplicationUserManager userManager,
            IHttpContextAccessor contextAccessor,
            IUserClaimsPrincipalFactory <User> claimsFactory,
            IOptions <IdentityOptions> optionsAccessor,
            ILogger <ApplicationSignInManager> logger)
            : base((UserManager <User>)userManager, contextAccessor, claimsFactory, optionsAccessor, logger)
        {
            _userManager = userManager;
            _userManager.CheckArgumentIsNull(nameof(_userManager));

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

            _claimsFactory = claimsFactory;
            _claimsFactory.CheckArgumentIsNull(nameof(_claimsFactory));

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

            _logger = logger;
            _logger.CheckArgumentIsNull(nameof(_logger));
        }
Пример #12
0
        public DbInitializerService(
            IServiceScopeFactory scopeFactory,
            ISecurityService securityService,
            IOptions <AdminUserSeedOptions> adminUserSeedOptions,
            IUsersService usersService,
            IRolesService rolesService
            )
        {
            _scopeFactory = scopeFactory;
            _scopeFactory.CheckArgumentIsNull(nameof(_scopeFactory));

            _securityService = securityService;
            _securityService.CheckArgumentIsNull(nameof(_securityService));

            _adminUserSeedOptions = adminUserSeedOptions;
            _adminUserSeedOptions.CheckArgumentIsNull(nameof(_adminUserSeedOptions));

            _usersService = usersService;
            _usersService.CheckArgumentIsNull(nameof(_usersService));

            _rolesService = rolesService;
            _rolesService.CheckArgumentIsNull(nameof(_rolesService));
        }
Пример #13
0
        public UserService(
            IUserStoreService userStoreService,
            IUserTokenStorageService userTokenStorageService,
            IOptions <IdentityOptions> optionsAccessor,
            IPasswordHasher <User> passwordHasher,
            IEnumerable <IUserValidator <User> > userValidators,
            IEnumerable <IPasswordValidator <User> > passwordValidators,
            ILookupNormalizer keyNormalizer,
            ISecurityService securityService,
            IdentityErrorDescriber identityErrorDescriber,
            IServiceProvider serviceProvider,
            ILogger <UserService> logger,
            IHttpContextAccessor httpContextAccessor,
            IUnitOfWork unitOfWork,
            IEmailService emailService,
            IAntiForgeryCookieService antiForgeryCookieService,
            IOptionsSnapshot <SiteSettings> options,
            IUsedPasswordService usedPasswordService,
            IUserTokenFactoryService userTokenFactoryService,
            IMapper mapper)
            : base((IUserStore <User>)userStoreService, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, identityErrorDescriber, serviceProvider, logger)
        {
            _userStoreService = userStoreService;
            _userStoreService.CheckArgumentIsNull(nameof(_userStoreService));

            _userTokenStorageService = userTokenStorageService;
            _userTokenStorageService.CheckArgumentIsNull(nameof(_userTokenStorageService));

            _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));

            _securityService = securityService;
            _securityService.CheckArgumentIsNull(nameof(_securityService));

            _identityErrorDescriber = identityErrorDescriber;
            _identityErrorDescriber.CheckArgumentIsNull(nameof(_identityErrorDescriber));

            _serviceProvider = serviceProvider;
            _serviceProvider.CheckArgumentIsNull(nameof(_serviceProvider));

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

            _stringEncryption = new StringEncryption();
            _stringEncryption.CheckArgumentIsNull(nameof(_stringEncryption));

            _httpContextAccessor = httpContextAccessor;
            _httpContextAccessor.CheckArgumentIsNull(nameof(_httpContextAccessor));

            _unitOfWork = unitOfWork;
            _unitOfWork.CheckArgumentIsNull(nameof(_unitOfWork));

            _usedPasswordService     = usedPasswordService;
            _userTokenFactoryService = userTokenFactoryService;
            _mapper = mapper;
            _usedPasswordService.CheckArgumentIsNull(nameof(_usedPasswordService));

            _antiForgeryCookieService = antiForgeryCookieService;
            _antiForgeryCookieService.CheckArgumentIsNull(nameof(_antiForgeryCookieService));

            _emailService = emailService;
            _emailService.CheckArgumentIsNull(nameof(_emailService));

            options.CheckArgumentIsNull(nameof(options));
            _options      = options;
            _smsTemplates = options.Value.SmsTemplates;

            _users = _unitOfWork.Set <User>();
            _roles = _unitOfWork.Set <Role>();
        }