i have the following code in the startup class in asp.net core 2.0 app
public void ConfigureServices(IServiceCollection services) { services.AddDbContext<AppIdentityDbContext>(options => options.UseSqlServer(Configuration["Data:SportStoreIdentity:ConnectionString"]) ); // a custom class to validate passwords services.AddTransient<IPasswordValidator<AppUser>, CustomPasswordValidator>(); services.AddIdentity<AppUser, IdentityRole>(opts => { // those options are overriden by the CustomPasswordValidator class if present // as a dependency injection opts.Password.RequireDigit = true; opts.Password.RequiredLength = 1; opts.Password.RequireLowercase = false; opts.Password.RequireNonAlphanumeric = false; opts.Password.RequireUppercase = false; opts.User.RequireUniqueEmail = true; }) .AddEntityFrameworkStores<AppIdentityDbContext>() .AddDefaultTokenProviders(); services.AddMvc(); }
why CustomPasswordValidator override rules introduced by the AddIdentity method?
how that works?