Integrating with Quickstarts

Integrating AdminUI with the IdentityServer 4 "Using ASP.NET Core Identity" Quickstart

If you have been following the IdentityServer Quickstarts whilst you are evaluating the framework, you can easily integrate AdminUI using the instructions below. Using the Quickstarts that build upon the ASP.NET Core Identity Visual Studio templates is not recommended for production scenarios, due to their fragility and abuse of anti-patterns.

Required Packages

To get started, you're going to need the AdminUI ASP.NET Core Identity schema. This simply builds upon the defaults found in the ASP.NET Core Identity Entity Framework library.

To install this package either use the nuget package manager console with:

install-package IdentityExpress.Identity

or search the package manager for IdentityExpress.Identity.

Registration & Usage Changes

We'll now need to swap some of the base entities with AdminUI/IdentityServer specifics. Please follow the below steps:

  1. Delete Models\ApplicationUser.cs
  2. Replace all usages of ApplicationUser with IdentityExpressUser
  3. Replace all usages of IdentityRole with IdentityExpressRole
  4. Delete Data\ApplicationDbContext.cs
  5. Replace .AddEntityFrameworkStores<IdentityExpressDbContext>() with .AddUserStore<IdentityExpressUserStore>().AddRoleStore<IdentityExpressRoleStore>()
  6. Delete any ASP.NET Core Identity migrations, AdminUI must be in charge of the user store migrations

Your ASP.NET Core DI registrations should now look something like the following:

services.AddDbContext<IdentityExpressDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

services.AddIdentity<IdentityExpressUser, IdentityExpressRole>()
  .AddUserStore<IdentityExpressUserStore>()
  .AddRoleStore<IdentityExpressRoleStore>()
  .AddDefaultTokenProviders();