コード例 #1
0
        public static UserManagerToken Create(IdentityFactoryOptions <UserManagerToken> options, IOwinContext context)
        {
            var appDbContext   = context.Get <DbContext.IdentityDbContext>();
            var appUserManager = new UserManagerToken(new IdentityUserStore(appDbContext));

            appUserManager.UserValidator = new UserValidator <User, Guid>(appUserManager)
            {
                AllowOnlyAlphanumericUserNames = true,
                RequireUniqueEmail             = true
            };

            appUserManager.PasswordValidator = new PasswordValidator
            {
                RequiredLength          = Commons.Constants.PasswordMinLenght,
                RequireNonLetterOrDigit = true,
                RequireDigit            = true,
                RequireLowercase        = true,
                RequireUppercase        = true,
            };

            appUserManager.EmailService = new EmailService();

            var dataProtectionProvider = options.DataProtectionProvider;

            if (dataProtectionProvider != null)
            {
                appUserManager.UserTokenProvider = new DataProtectorTokenProvider <User, Guid>(dataProtectionProvider.Create(Commons.Constants.DataProtectorTokenProviderPurposes))
                {
                    TokenLifespan = TimeSpan.FromMinutes(Commons.Constants.TokenLifespanMinutes)
                };
            }

            return(appUserManager);
        }
コード例 #2
0
 public SignInManagerToken(UserManagerToken userManager, IAuthenticationManager authenticationManager) : base(userManager, authenticationManager)
 {
 }
コード例 #3
0
 public ModelFactory(UserManagerToken userManager)
 {
     UserManagerToken = userManager;
 }