public async Task <ClaimsIdentity> GenerateUserIdentityAsync(MyUserManager userManager) { var userIdentity = await userManager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); // Add custom user claims here return(userIdentity); }
public static MyUserManager Create(IdentityFactoryOptions <MyUserManager> options, IOwinContext context) { var manager = new MyUserManager( new UserStore <MyUser, MyRole, int, MyLogin, MyUserRole, MyClaim>( context.Get <ApplicationDbContext>())); // Configure validation logic for usernames manager.UserValidator = new UserValidator <MyUser, int>(manager) { AllowOnlyAlphanumericUserNames = false, RequireUniqueEmail = true }; // Configure validation logic for passwords manager.PasswordValidator = new PasswordValidator() { RequireDigit = false, RequireLowercase = false, RequireNonLetterOrDigit = false, RequireUppercase = false, RequiredLength = 0 }; return(manager); }
public static MyUserManager Initialize() { var manager = new MyUserManager( new UserStore <MyUser, MyRole, int, MyLogin, MyUserRole, MyClaim>(new ApplicationDbContext())); // Configure validation logic for usernames manager.UserValidator = new UserValidator <MyUser, 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, }; return(manager); }
public AuthRepository() { _userManager = MyUserManager.Initialize(); _ctx = new ApplicationDbContext(); }