ASP.NET Core Interview Question #139
What is ASP.NET Core Identity?
Authentication, Authorization & Security Mid-Level Intermediate
Quick Interview Answer
ASP.NET Core Identity is a membership system for managing application users. It provides services for user creation, password hashing, sign-in, roles, claims, tokens, email confirmation, password reset, lockout, and related account features.
Detailed Explanation
ASP.NET Core Identity is a membership system for managing application users. It provides services for user creation, password hashing, sign-in, roles, claims, tokens, email confirmation, password reset, lockout, and related account features.
Identity is commonly backed by Entity Framework Core but is extensible. It should be configured according to the application's security requirements rather than relying blindly on defaults.
Code Example
builder.Services.AddDefaultIdentity<ApplicationUser>(options =>
{
options.SignIn.RequireConfirmedAccount = true;
})
.AddRoles<IdentityRole>()
.AddEntityFrameworkStores<AuthDbContext>();