Duende IdentityServer v5.2 to v6.0

This upgrade guide covers upgrading from Duende IdentityServer v5.2 to v6.0 (release notes). The most significant aspect of this upgrade is that Duende IdentityServer v6.0 targets .NET 6, and CIBA support was added.

With any major release, there is always the possibility of some breaking changes. This issue tracks the list of updates where a breaking change might affect your use of IdentityServer. It would be useful to review it to understand if any of these changes affect you.

Step 1: Update to .NET 6

In your IdentityServer host project, update the version of the .NET framework. For example in your project file:

<TargetFramework>netcoreapp3.1</TargetFramework>

would change to:

<TargetFramework>net6.0</TargetFramework>

Also, any other NuGets that you were previously using that targeted an older version of .NET should be updated. For example, Microsoft.EntityFrameworkCore.SqlServer or Microsoft.AspNetCore.Authentication.Google. Depending on what your application was using, there may or may not be code changes based on those updated NuGet packages.

Step 2: Update the IdentityServer NuGet package

In your IdentityServer host project, update the version of the Duende IdentityServer NuGet. For example in your project file:

<PackageReference Include="Duende.IdentityServer" Version="5.2.0" />

would change to:

<PackageReference Include="Duende.IdentityServer" Version="6.0.0" />

Step 3: Update Database Schema (if needed)

If you are using a database for your configuration data, then there is a small database schema update. This includes:

  • Add missing columns for created, updated, etc to EF entities (more details).
  • Add unique constraints to EF tables where duplicate records not allowed (more details).

If you are using the Duende.IdentityServer.EntityFramework package as the implementation for the database and you’re using EntityFramework Core migrations as the mechanism for managing those schema changes over time, the commands below will update those migrations with the new changes. Note that you might need to adjust based on your specific organization of the migration files.

dotnet ef migrations add Update_DuendeIdentityServer_v6_0 -c ConfigurationDbContext -o Data/Migrations/IdentityServer/ConfigurationDb

You will likely get the warning “An operation was scaffolded that may result in the loss of data. Please review the migration for accuracy.”. This is due to the fact that in this release the column length for redirect URIs (for both login and logout) was reduced from 2000 to 400. This was needed because some database providers have limits on index size. This should not affect you unless you are using redirect URIs greater than 400 characters.

Then to apply those changes to your database:

dotnet ef database update -c ConfigurationDbContext

Step 4: Done!

That’s it. Of course, at this point you can and should test that your IdentityServer is updated and working properly.