You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/identityserver/upgrades/identityserver4-to-duende-identityserver-v7.mdx
+9-35Lines changed: 9 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ This upgrade guide covers upgrading from IdentityServer4 to Duende IdentityServe
14
14
IdentityServer4 reached its end of life (EOL) on December 13, 2022. It is strongly advised to migrate to Duende IdentityServer.
15
15
16
16
Depending on your current version of IdentityServer4, different steps may be required.
17
-
You can determine the version of IdentityServer4 by running the `dotnet list` command at the root of your project, or using NuGet tooling in Visual Studio or JetBrains Rider.
17
+
You can determine the version of IdentityServer4 by running the `dotnet list` command at the root of your IdentityServer host project, or using NuGet tooling in Visual Studio or JetBrains Rider.
18
18
19
19
<Tabs>
20
20
<TabItemlabel="Windows">
@@ -38,8 +38,6 @@ This command will print a list of packages you are using in your solution, along
Depending on the package version shown, your next steps will be different:
@@ -63,6 +61,8 @@ Between IdentityServer4 v3.x and v4.x, the configuration object model was update
63
61
64
62
IdentityServer4 projects that use the `IdentityServer4.EntityFramework` package or implement their own stores will need to update their code and/or database to reflect these changes.
65
63
64
+
Database changes will need to be done using a custom migration script, as using the default Entity Framework Core migration will result in data loss. We'll look at this later in this upgrade guide.
65
+
66
66
:::tip[Sample project]
67
67
We have a [sample project available on GitHub](https://github.com/DuendeSoftware/UpgradeSample-IdentityServer4-v3), which contains database migration scripts for these changes.
68
68
:::
@@ -97,7 +97,7 @@ A couple of compilation errors and required changes you may encounter:
- No overload method `SignInAsync` takes 5 arguments. The `HttpContext.SignInAsync` signature changed:
100
+
- No overload method `SignInAsync` takes N arguments. The `HttpContext.SignInAsync` signature changed:
101
101
102
102
```diff lang="csharp" title="*.cs"
103
103
// issue authentication cookie with subject ID and username
@@ -387,12 +387,14 @@ You can use Duende IdentityServer's built-in [manual or automatic key management
387
387
Whether you are using a [database](../../data) or a [custom store implementation](../..//reference/stores) for your configuration and operational data, you'll need to make some changes.
388
388
The exact steps involved in updating your data store will depend on your implementation details.
389
389
390
+
In this section, we'll look at updating the database schema based on the stores provided in the `Duende.IdentityServer.EntityFramework` package:
391
+
390
392
- Create a new `Keys` table for the automatic key management feature in the operational database.
391
393
- Create a new `RequireResourceIndicator` boolean column on the `ApiResources` table in the configuration database.
392
394
- Create a new index on the `ConsumedTime` column in the `PersistedGrants` table ([more details](https://github.com/DuendeSoftware/products/pull/84)).
393
395
- Create a new table called `IdentityProviders` for storing the OIDC provider details ([more details](https://github.com/DuendeSoftware/products/pull/188)).
394
396
- Add missing columns for created, updated, etc. to EF entities ([more details](https://github.com/DuendeSoftware/products/pull/356)).
395
-
- Add unique constraints to EF tables where duplicate records not allowed ([more details](https://github.com/DuendeSoftware/products/pull/355)).
397
+
- Add unique constraints to EF tables where duplicate records are not allowed ([more details](https://github.com/DuendeSoftware/products/pull/355)).
396
398
- The server-side sessions feature requires a new table ([more details](https://github.com/DuendeSoftware/products/pull/743)).
397
399
- The session coordination feature adds a column to the `Clients` table ([more details](https://github.com/DuendeSoftware/products/pull/820)).
398
400
- Improve primary keys on the persisted grants table ([more details](https://github.com/DuendeSoftware/products/pull/793)).
@@ -403,15 +405,12 @@ The exact steps involved in updating your data store will depend on your impleme
403
405
-`DPoPValidationMode` is a non-nullable column that controls the DPoP validation mechanism. Existing clients that are not using DPoP can set its value to `0`.
404
406
-`DPoPClockSkew` is a non-nullable timespan that controls how much clock skew is allowed for a particular DPoP client. Existing clients that are not using DPoP can set its value to a timespan of length ``0.
405
407
406
-
- The `ServerSideSession` entity now uses a 64-bit long as its primary key.
407
408
- Two new properties have been added to the `Client` model:
408
409
-`Client.RequirePushedAuthorization` is a new boolean property that controls if this client requires [pushed authorization requests (PAR)](../../tokens/par). It is safe to initialize this column to `false` for existing clients, which will mean that the global PAR configuration will be used.
409
410
-`Client.PushedAuthorizationLifetime` is a new nullable integer property that controls the lifetime of pushed
410
411
authorization requests (in seconds) for a client. It is safe to initialize this column to `null` for existing clients, which means the global value is used.
411
412
- A new `PushedAuthorizationRequest` table has been added to store pushed authorization requests.
412
413
413
-
In this section, we'll look at updating the database schema based on the stores provided in the `Duende.IdentityServer.EntityFramework` package.
414
-
415
414
You'll need to create two database migrations that update the database schema: one that targets the `PersistedGrantDbContext` (for operational data), and one that targets the `ConfigurationDbContext` (for configuration data).
416
415
Note that you may want to change the database migration paths in the examples below to match your project structure.
417
416
@@ -441,7 +440,7 @@ Note that you may want to change the database migration paths in the examples be
If your IdentityServer4 implementation is using a signing key, consider using [automatic key management](../../fundamentals/key-management).
443
+
If your IdentityServer4 implementation is using a signing key, consider using [automatic key management](../../fundamentals/key-management) which is included in the Business license.
445
444
446
445
:::tip[Determine if you are using a custom signing key]
447
446
In `Startup.cs`, look for a call to `AddSigningCredential()` that uses key material such as an `X509Certificate2`.
@@ -453,32 +452,7 @@ When upgrading, consider how those applications will handle an upgraded token se
453
452
- If you can restart all client apps and APIs that depend on your current signing key, you can remove the old signing key and start to use automatic key management. A restart reloads the discovery document and the new signing key.
454
453
- If you can not restart client apps and APIs, check the [manual and automatic key rotation topics](../../fundamentals/key-management#manual-key-rotation) to learn how to announce new signing key material while still supporting the old signing key for a period of time.
455
454
456
-
### Step 7: Verify Data Protection Configuration
457
-
458
-
Duende IdentityServer depends on [ASP.NET Data Protection](../../deployment#aspnet-core-data-protection) to encrypt and sign data using keys managed by ASP.NET.
459
-
460
-
As part of your migration, verify the application name is set in your Data Protection configuration:
461
-
462
-
```cs title="Program.cs" {4}
463
-
builder.Services.AddDataProtection()
464
-
.PersistKeysTo...()
465
-
.ProtectKeysWith...()
466
-
.SetApplicationName("IdentityServer");
467
-
```
468
-
469
-
If an application name is set, you can skip this section. If no name is set, it is important to read on.
470
-
471
-
Data Protection keys are isolated by application name, to prevent multiple applications from sharing encryption keys.
472
-
If no application name is configured, ASP.NET Data Protection uses the content root path of the IdentityServer host as the application name.
473
-
474
-
As a consequence, if your content root path changes, the default settings for data protection will prevent you from using your old data protection keys.
475
-
476
-
.NET 6 introduced a change where the (default) content root path is now normalized to end with a directory separator.
477
-
This means that your application name might change as part of this upgrade, and by extensions, existing data protection keys may become invalid.
478
-
479
-
To prevent this from happening, you can explicitly set the application name to the content root path without the directory separator character, as [documented on Microsoft Learn](https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/configuration/overview?view=aspnetcore-6.0#setapplicationname).
0 commit comments