Esempio n. 1
0
        internal async Task <ClaimsIdentity> GenerateUserIdentityAsync(CustomUserManager userManager, string authenticationType)
        {
            // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
            var userIdentity = await userManager.CreateIdentityAsync(this, authenticationType);

            // Add custom user claims here
            return(userIdentity);
        }
Esempio n. 2
0
        public static CustomUserManager Create(IdentityFactoryOptions <CustomUserManager> options, IOwinContext context)
        {
            var manager = new CustomUserManager(
                new CustomUserStore(
                    //(IUserInfoService)System.Web.Mvc.DependencyResolver.Current.GetService(typeof(IUserInfoService)),
                    //(IRoleService)System.Web.Mvc.DependencyResolver.Current.GetService(typeof(IRoleService)),
                    (IUnitOfWork)System.Web.Mvc.DependencyResolver.Current.GetService(typeof(IUnitOfWork))));

            //(IMapper)System.Web.Mvc.DependencyResolver.Current.GetService(typeof(IMapper))));
            manager.PasswordValidator = new PasswordValidator();
            manager.UserValidator     = new UserValidator <User, int>(manager)
            {
                AllowOnlyAlphanumericUserNames = false,
                RequireUniqueEmail             = false
            };
            return(manager);
        }