Dependencies:-
- Asp.NetCore
- EntityFrameWorkCore
ASP.NET Core Microsoft Identity is a robust and flexible membership system that enables you to add authentication and authorization features to your web applications.
It is an API that manages users, passwords, profile data, roles, tokens, email confirmation, external logins etc.
Packages Needed :
- EntityFramework Packages : Microsoft.EntityFramework.Core, Microsoft.EntityFramework.Core.Tools, Microsoft.EntityFramework.Core.SqlServer
- Microsoft.AspNetCore.Identity : acts as a membership system or platform for other packages that implement Identity , installed where DbContext class Exists
- Microsoft.AspNetCore.Identity.EntityFrameworkCore : as we will use EntityFrameworkCore to create and Store Identity tables to database, repo functionalities will be write using Linq , installed twice one with the above one and in the presentation layer or Asp.NetCore API/MVC project as it will be used by IOC container
IdentityUser<T>
Acts as a base class for ApplicationUser class that acts as model class to store user details.
You can add additional properties to the ApplicationUser class.
T represent the type of the Id will be created in most cases you will set it as string , Long, or Guid
basic common properties
- Id , UserName , PasswordHash , Email, PhoneNumber
IdentityRole<T>
Acts as a base class for ApplicationRole class that acts as model class to store role details. Eg: "admin"
You can add additional properties to the ApplicationRole class.
Built-in Properties