Setting up IdentityManager2
The first step is to load the package. Use the already open command line or the terminals in VS Code or Visual Studio:
dotnet add package IdentityManager2
If the package is loaded, open Program.cs
and add IdentityManager2 to the service collection:
builder.Services.AddIdentityManager();
Change the service registration of ASP.NET Identity from the following:
builder.Services.AddDefaultIdentity<ApplicationUser>{ …
To this:
builder.Services.AddIdentity<ApplicationUser, IdentityRole>( …
This adds some more relevant services to the service collection.
Also, DefaultTokenProvider
needs to be added:
builder.Services.AddIdentity<ApplicationUser, IdentityRole>( … ) .AddEntityFrameworkStores<ApplicationDbContext>() .AddDefaultTokenProviders();
That's it with the services for now.
Then IdentityServer
needs to be added to the pipeline...