public static NokUserMangare Create(IdentityFactoryOptions <NokUserMangare> options, IOwinContext context) { var manager = new NokUserMangare(new UserStore <NokUser>(SingleToneDb.Get())); var identitySettings = new IdentitySettings(); // Configure validation logic for usernames manager.UserValidator = new UserValidator <NokUser>(manager) { AllowOnlyAlphanumericUserNames = identitySettings.AllowOnlyAlphanumericUserNames, RequireUniqueEmail = identitySettings.RequireUniqueEmail }; // Configure validation logic for passwords manager.PasswordValidator = new PasswordValidator { RequiredLength = identitySettings.MinimumPasswordLength, RequireNonLetterOrDigit = identitySettings.RequireNonLetterOrDigit, RequireDigit = identitySettings.RequireDigit, RequireLowercase = identitySettings.RequireLowercase, RequireUppercase = identitySettings.RequireUppercase, }; // Configure user lockout defaults manager.UserLockoutEnabledByDefault = identitySettings.UserLockoutEnabledByDefault; manager.DefaultAccountLockoutTimeSpan = identitySettings.DefaultAccountLockoutTimeSpan; manager.MaxFailedAccessAttemptsBeforeLockout = identitySettings.MaxFailedAccessAttemptsBeforeLockout; // Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user // You can write your own provider and plug it in here. manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider <NokUser> { MessageFormat = "Your security code is {0}" }); manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider <NokUser> { Subject = "Security Code", BodyFormat = "Your security code is {0}" }); manager.EmailService = new EmailService(); // manager.SmsService = new SmsService(); var dataProtectionProvider = options.DataProtectionProvider; if (dataProtectionProvider != null) { manager.UserTokenProvider = new DataProtectorTokenProvider <NokUser>(dataProtectionProvider.Create("ASP.NET Identity")); } return(manager); }
public NokSignInManager(NokUserMangare userManager, IAuthenticationManager authenticationManager) : base(userManager, authenticationManager) { }