Exemple #1
0
        /// <summary>
        /// Crea un nuevo <see cref="IsssteUserManager{TUser}"/>
        /// </summary>
        /// <param name="options">Opciones para la creación</param>
        /// <param name="context">Contexto Owin a utilizar</param>
        /// <returns>Nuevo user manager</returns>
        public static IsssteUserManager <TUser> Create(IdentityFactoryOptions <IsssteUserManager <TUser> > options, IOwinContext context)
        {
            var manager = new IsssteUserManager <TUser>(new UserStore <TUser>(context.Get <IsssteIdentityDbContext>()));

            // Configure validation logic for usernames
            manager.UserValidator = new UserValidator <TUser>(manager)
            {
                AllowOnlyAlphanumericUserNames = false,
                RequireUniqueEmail             = false
            };
            // Configure validation logic for passwords
            manager.PasswordValidator = new PasswordValidator
            {
                RequiredLength          = 6,
                RequireNonLetterOrDigit = true,
                RequireDigit            = true,
                RequireLowercase        = true,
                RequireUppercase        = true,
            };
            var dataProtectionProvider = options.DataProtectionProvider;

            if (dataProtectionProvider != null)
            {
                manager.UserTokenProvider = new DataProtectorTokenProvider <TUser>(dataProtectionProvider.Create("ASP.NET Identity"));
            }
            return(manager);
        }
Exemple #2
0
 /// <summary>
 /// Constructor de la clase
 /// </summary>
 /// <param name="userManager"><see cref="IsssteUserManager{TUser}"/> a utilizar</param>
 /// <param name="authenticationManager"><see cref="IAuthenticationManager"/> a utilizar</param>
 public IsssteSignInManager(IsssteUserManager <TUser> userManager, IAuthenticationManager authenticationManager)
     : base(userManager, authenticationManager)
 {
 }