liveBook · Manning

AddDefaultIdentity

As explained in ASP.NET Core in Action, 3e

AddDefaultIdentity is an ASP.NET Core Identity service-registration extension method that configures core Identity services, a user type, default UI pages, and token providers.

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>();

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains the method's four main configuration effects and shows database-store registration, but does not detail Identity internals.
Examples
Uses IdentityUser registration with confirmed accounts and an ApplicationDbContext-backed Entity Framework store.
What it assumes
Assumes an ASP.NET Core application and an Entity Framework Core ApplicationDbContext for persistent users.
What you can do after
Configure Identity services, default account pages, token providers, and an Entity Framework user store.
How it connects
Connects IdentityUser, Entity Framework Core, Razor Pages, token providers, authentication, and authorization middleware.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.