Exemple #1
0
        public AdminController(
            IHtmlLocalizer htmlLocalizer,
            IStringLocalizer stringLocalizer,
            IUserSecurityStampStore <User> securityStampStore,
            IAuthorizationService authorizationService,
            IPlatoUserManager <User> platoUserManager,
            IViewProviderManager <User> viewProvider,
            IBreadCrumbManager breadCrumbManager,
            IPlatoUserStore <User> platoUserStore,
            UserManager <User> userManager,
            IContextFacade contextFacade,
            IUserEmails userEmails,
            IAlerter alerter)
        {
            _authorizationService = authorizationService;
            _securityStampStore   = securityStampStore;
            _breadCrumbManager    = breadCrumbManager;
            _platoUserManager     = platoUserManager;
            _platoUserStore       = platoUserStore;
            _contextFacade        = contextFacade;
            _viewProvider         = viewProvider;
            _userManager          = userManager;
            _userEmails           = userEmails;
            _alerter = alerter;


            T = htmlLocalizer;
            S = stringLocalizer;
        }
Exemple #2
0
        private IUserSecurityStampStore <ApplicationUser> GetSecurityStore()
        {
            IUserSecurityStampStore <ApplicationUser> store = Store as IUserSecurityStampStore <ApplicationUser>;

            if (store != null)
            {
                return(store);
            }
            throw new NotSupportedException("User store is not of type user security stamp store");
        }
Exemple #3
0
        private IUserSecurityStampStore <TUser> GetSecurityStampStore()
        {
            IUserSecurityStampStore <TUser> store = Store as IUserSecurityStampStore <TUser>;

            if (store == null)
            {
                throw new NotSupportedException("Store isn't a security stamp store!");
            }

            return(store);
        }
Exemple #4
0
 public SetupController(ISetupProvider setupProvider,
                        IUserSecurityStampStore <ApplicationUser> userSecurityStampStore,
                        IPasswordHasher <ApplicationUser> passwordHasher, IUserManager <ApplicationUser> userManager,
                        IDataSeedService dataSeedService, ILoginManager <ApplicationUser> loginManager)
 {
     _setupProvider          = setupProvider;
     _userSecurityStampStore = userSecurityStampStore;
     _passwordHasher         = passwordHasher;
     _userManager            = userManager;
     _loginManager           = loginManager;
     _dataSeedService        = dataSeedService;
 }
Exemple #5
0
        public DiTestController(
            // the Microsoft.AspNetCore.Identity User and Role Manager classes
            RoleManager <IdentityRole> roleManager,
            UserManager <ApplicationUser> userManager,

            IIdentityDatabaseContext <ApplicationUser, IdentityRole, string> identityDatabaseContext,

            // if want to use with SOLID and Interface Segregation Principle, then can just use the specific interface that need

            // these interfaces are all implemented by UserStore
            IUserStore <ApplicationUser> userStore,
            IUserLoginStore <ApplicationUser> userLoginStore,
            IUserRoleStore <ApplicationUser> userRoleStore,
            IUserClaimStore <ApplicationUser> userClaimStore,
            IUserPasswordStore <ApplicationUser> userPasswordStore,
            IUserSecurityStampStore <ApplicationUser> userSecurityStampStore,
            IUserEmailStore <ApplicationUser> userEmailStore,
            IUserLockoutStore <ApplicationUser> userLockoutStore,
            IUserPhoneNumberStore <ApplicationUser> userPhoneNumberStore,
            IUserTwoFactorStore <ApplicationUser> userTwoFactorStore,
            IQueryableUserStore <ApplicationUser> queryableUserStore,

            // these interfaces are all implemented by RoleStore
            IRoleStore <IdentityRole> roleStore,
            IRoleClaimStore <IdentityRole> roleClaimStore,
            IQueryableRoleStore <IdentityRole> queryableRoleStore
            )
        {
            _roleManager = roleManager;
            _userManager = userManager;

            _identityDatabaseContext = identityDatabaseContext;
            _userStore              = userStore;
            _userLoginStore         = userLoginStore;
            _userRoleStore          = userRoleStore;
            _userClaimStore         = userClaimStore;
            _userPasswordStore      = userPasswordStore;
            _userSecurityStampStore = userSecurityStampStore;
            _userEmailStore         = userEmailStore;
            _userLockoutStore       = userLockoutStore;
            _userPhoneNumberStore   = userPhoneNumberStore;
            _userTwoFactorStore     = userTwoFactorStore;
            _queryableUserStore     = queryableUserStore;

            _roleStore          = roleStore;
            _roleClaimStore     = roleClaimStore;
            _queryableRoleStore = queryableRoleStore;
        }
Exemple #6
0
        public virtual async Task <string> GetSecurityStampAsync(TUser user)
        {
            ThrowIfDisposed();
            IUserSecurityStampStore <TUser> securityStampStore = GetSecurityStampStore();

            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            string stamp = await securityStampStore.GetSecurityStampAsync(user, CancellationToken);

            if (stamp == null)
            {
                Logger.LogWarning(LoggerEventIds.GetSecurityStampFailed, "User stamp null!");
                throw new InvalidOperationException("Null security stamp!");
            }
            return(stamp);
        }
Exemple #7
0
        public PlatoUserManager(
            IStringLocalizer <PlatoUserManager <TUser> > stringLocalizer,
            IUserSecurityStampStore <TUser> securityStampStore,
            IPlatoUserStore <TUser> platoUserStore,
            IUserColorProvider userColorProvider,
            ISiteSettingsStore siteSettingsStore,
            IClientIpAddress clientIpAddress,
            UserManager <TUser> userManager,
            IBroker broker)
        {
            _securityStampStore = securityStampStore;
            _siteSettingsStore  = siteSettingsStore;
            _userColorProvider  = userColorProvider;
            _clientIpAddress    = clientIpAddress;
            _platoUserStore     = platoUserStore;
            _userManager        = userManager;
            _broker             = broker;

            T = stringLocalizer;
        }