After using the IdentityServer Quickstarts to evaluate the framework, it is then possible to integrate AdminUI for production use.
Note: Quickstarts built using the ASP.NET Core Identity Visual Studio templates are not recommended for production, due to their fragility and abuse of anti-patterns.
Update Packages
When using the code from the samples repository, ensure all packages are up-to-date (excluding pre-releases).
Required Packages
AdminUI uses a custom ASP.NET Core Identity schema. This schema extends from the ASP.NET Core Identity Entity Framework defaults, which means any existing registration, password reset or login functionality will continue to work with the AdminUI user store.
This schema is available on nuget using the IdentityExpress.Identity
package.
Use the following command to install using the nuget package manager console:
install-package IdentityExpress.Identity
Registration & Usage Changes
Some base entities with AdminUI/IdentityServer specifics need to be updated:
- Delete
Models\ApplicationUser.cs
- Replace all usages of
ApplicationUser
withIdentityExpressUser
- Replace all usages of
IdentityRole
withIdentityExpressRole
- Delete
Data\ApplicationDbContext.cs
- Replace
.AddEntityFrameworkStores<IdentityExpressDbContext>()
with.AddUserStore<IdentityExpressUserStore>().AddRoleStore<IdentityExpressRoleStore>()
- Add
.AddIdentityExpressUserClaimsPrincipalFactory()
to ensure user data is correctly transformed into claims - Delete any ASP.NET Core Identity migrations, AdminUI must be in charge of the user store migrations
The ASP.NET Core DI registrations should now look similar to this:
services.AddDbContext<IdentityExpressDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddIdentity<IdentityExpressUser, IdentityExpressRole>()
.AddUserStore<IdentityExpressUserStore>()
.AddRoleStore<IdentityExpressRoleStore>()
.AddIdentityExpressUserClaimsPrincipalFactory()
.AddDefaultTokenProviders();