我正在使用asp.net mvc 5与外部提供商owin提供(facebook,twitter)
每次请求都会调用ApplicationUserManager.Create.登录用户有很多不必要的东西(密码验证器配置或短信和电子邮件服务配置....)
var manager = new ApplicationUserManager(new UserStore<ApplicationUser>(context.Get<ApplicationDbContext>()));
// Configure validation logic for usernames
manager.UserValidator = new UserValidator<ApplicationUser>(manager)
{
AllowOnlyAlphanumericUserNames = true,
RequireUniqueEmail = true
};
// Configure validation logic for passwords
manager.PasswordValidator = new PasswordValidator
{
RequiredLength = 7,
RequireNonLetterOrDigit = false,
RequireDigit = true,
RequireLowercase = true,
RequireUppercase = true,
};
...
Run Code Online (Sandbox Code Playgroud)
此外,我认为这与此有关
public partial class Startup
{
public void ConfigureAuth(IAppBuilder app)
// Configure the db context, user manager and signin manager to use a single …Run Code Online (Sandbox Code Playgroud)