docs/en/release-info/migration-guides/identityserver4-step-by-step.md
//[doc-seo]
{
"Description": "Step-by-step guide for migrating from OpenIddict to IdentityServer4 in ABP Framework applications, ensuring a smooth transition for developers."
}
ABP startup templates use the OpenIddict OpenID provider from v6.0.0 by default, and IdentityServer projects were renamed to AuthServer in tiered/separated solutions. This guide provides the v6.0-era, layer-by-layer steps for migrating an existing OpenIddict application to IdentityServer4.
IdentityServer4 is archived and no longer maintained by its owners. ABP doesn't support newer IdentityServer or Duende IdentityServer versions through this module. Use this guide only when an existing system has a compatibility requirement that prevents migration to OpenIddict; new applications should remain on OpenIddict.
These steps target an application that is already on ABP 6.0.x. Keep every Volo.Abp.* package on the exact 6.0.x patch version used by the application. Complete any version update separately with the CLI and migration guides for that release line before applying these provider-replacement steps.
<PackageReference Include="Volo.Abp.OpenIddict.Domain.Shared" Version="6.0.*" />
with
<PackageReference Include="Volo.Abp.IdentityServer.Domain.Shared" Version="6.0.*" />
using Volo.Abp.OpenIddict;
...
typeof(AbpOpenIddictDomainSharedModule)
with
using Volo.Abp.IdentityServer;
...
typeof(AbpIdentityServerDomainSharedModule)
<PackageReference Include="Volo.Abp.OpenIddict.Domain" Version="6.0.*" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.OpenIddict" Version="6.0.*" />
with
<PackageReference Include="Volo.Abp.IdentityServer.Domain" Version="6.0.*" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.IdentityServer" Version="6.0.*" />
using Volo.Abp.OpenIddict;
using Volo.Abp.PermissionManagement.OpenIddict;
...
typeof(AbpOpenIddictDomainModule),
typeof(AbpPermissionManagementDomainOpenIddictModule),
with
using Volo.Abp.IdentityServer;
using Volo.Abp.PermissionManagement.IdentityServer;
...
typeof(AbpIdentityServerDomainModule),
typeof(AbpPermissionManagementDomainIdentityServerModule),
DataSeeder is the most important part for starting the application since it seeds the initial data for both OpenID providers.
OpenId2Ids with your project name.OpenIddictDataSeedContributor.cs which is no longer needed.If you are using MongoDB, skip this step and check the MongoDB layer section.
In MyApplication.EntityFrameworkCore.csproj replace project reference:
<PackageReference Include="Volo.Abp.OpenIddict.EntityFrameworkCore" Version="6.0.*" />
with
<PackageReference Include="Volo.Abp.IdentityServer.EntityFrameworkCore" Version="6.0.*" />
In MyApplicationEntityFrameworkCoreModule.cs replace usings and module dependencies:
using Volo.Abp.OpenIddict.EntityFrameworkCore;
...
typeof(AbpOpenIddictEntityFrameworkCoreModule),
with
using Volo.Abp.IdentityServer.EntityFrameworkCore;
...
typeof(AbpIdentityServerEntityFrameworkCoreModule),
In MyApplicationDbContext.cs replace usings and fluent api configurations:
using Volo.Abp.OpenIddict.EntityFrameworkCore;
...
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
/* Include modules to your migration db context */
...
builder.ConfigureOpenIddict();
with
using Volo.Abp.IdentityServer.EntityFrameworkCore;
...
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
/* Include modules to your migration db context */
...
builder.ConfigureIdentityServer();
Note: Create a new migration after updating the fluent API. Navigate to the EntityFrameworkCore folder and run, for example,
dotnet ef migrations add Updated_To_IdentityServer.
If you are using EntityFrameworkCore, skip this step and check the EntityFrameworkCore layer section.
In MyApplication.MongoDB.csproj replace project reference:
<PackageReference Include="Volo.Abp.OpenIddict.MongoDB" Version="6.0.*" />
with
<PackageReference Include="Volo.Abp.IdentityServer.MongoDB" Version="6.0.*" />
In MyApplicationMongoDbModule.cs replace usings and module dependencies:
using Volo.Abp.OpenIddict.MongoDB;
...
typeof(AbpOpenIddictMongoDbModule),
with
using Volo.Abp.IdentityServer.MongoDB;
...
typeof(AbpIdentityServerMongoDbModule),
In appsettings.json replace the OpenIddict section with IdentityServer because IdentityServerDataSeeder uses this configuration for initial data seeding. Rename the Applications property to Clients and preserve its existing child entries. The minimal valid structure is:
{
"IdentityServer": {
"Clients": {}
}
}
In MyApplicationTestBaseModule.cs add the IdentityServer related using and PreConfigurations:
using Volo.Abp.IdentityServer;
and
PreConfigure<AbpIdentityServerBuilderOptions>(options =>
{
options.AddDeveloperSigningCredential = false;
});
PreConfigure<IIdentityServerBuilder>(identityServerBuilder =>
{
identityServerBuilder.AddDeveloperSigningCredential(false, System.Guid.NewGuid().ToString());
});
to PreConfigureServices to run authentication related unit tests.
You can follow the migration guides from IdentityServer to OpenIddict in reverse order to update your UIs. You can also check the sample source for Index.cshtml.cs and Index.cshtml in the AuthServer project.