public static ApiApplicationUserManager Create(IdentityFactoryOptions <ApiApplicationUserManager> options, IOwinContext context) { var manager = new ApiApplicationUserManager(new ApplicationUserStore(context.Get <ApplicationDbContext>())); // Configure validation logic for usernames manager.UserValidator = new UserValidator <ApplicationUser, int>(manager) { AllowOnlyAlphanumericUserNames = false, RequireUniqueEmail = true }; // 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 <ApplicationUser, int>(dataProtectionProvider.Create("ASP.NET Identity")); } return(manager); }