AddDefaultIdentity is an ASP.NET Core service-registration extension method. It prepares a user system with core Identity services, a user entity, built-in account pages, and token providers. section 23.3.2
The method configures several application capabilities:
- Registers the core ASP.NET Core Identity services. section 23.3.2
- Uses IdentityUser as the application user entity stored in the database; applications can extend it when needed. section 23.3.2
- Adds default Razor Pages for registration, login, and user management. section 23.3.2
- Configures token providers for multifactor authentication and email-confirmation tokens. section 23.3.2
Register Identity with Entity Framework stores
builder.Services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true) .AddEntityFrameworkStores<ApplicationDbContext>();
