Skip to content

Commit c6c52e5

Browse files
committed
Process review comments
1 parent fede6b1 commit c6c52e5

1 file changed

Lines changed: 9 additions & 35 deletions

File tree

src/content/docs/identityserver/upgrades/identityserver4-to-duende-identityserver-v7.mdx

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This upgrade guide covers upgrading from IdentityServer4 to Duende IdentityServe
1414
IdentityServer4 reached its end of life (EOL) on December 13, 2022. It is strongly advised to migrate to Duende IdentityServer.
1515

1616
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.
1818

1919
<Tabs>
2020
<TabItem label="Windows">
@@ -38,8 +38,6 @@ This command will print a list of packages you are using in your solution, along
3838
```bash title="Output"
3939
> IdentityServer4 3.1.4 3.1.4
4040
> IdentityServer4.EntityFramework 3.1.4 3.1.4
41-
> IdentityServer4.AccessTokenValidation 3.0.1 3.0.1
42-
> IdentityServer4.AccessTokenValidation 2.6.0 2.6.0
4341
```
4442

4543
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
6361

6462
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.
6563

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+
6666
:::tip[Sample project]
6767
We have a [sample project available on GitHub](https://github.com/DuendeSoftware/UpgradeSample-IdentityServer4-v3), which contains database migration scripts for these changes.
6868
:::
@@ -97,7 +97,7 @@ A couple of compilation errors and required changes you may encounter:
9797
+ await _interaction.DenyAuthorizationAsync(context, AuthorizationError.AccessDenied);
9898
```
9999

100-
- 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:
101101

102102
```diff lang="csharp" title="*.cs"
103103
// 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
387387
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.
388388
The exact steps involved in updating your data store will depend on your implementation details.
389389

390+
In this section, we'll look at updating the database schema based on the stores provided in the `Duende.IdentityServer.EntityFramework` package:
391+
390392
- Create a new `Keys` table for the automatic key management feature in the operational database.
391393
- Create a new `RequireResourceIndicator` boolean column on the `ApiResources` table in the configuration database.
392394
- Create a new index on the `ConsumedTime` column in the `PersistedGrants` table ([more details](https://github.com/DuendeSoftware/products/pull/84)).
393395
- Create a new table called `IdentityProviders` for storing the OIDC provider details ([more details](https://github.com/DuendeSoftware/products/pull/188)).
394396
- 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)).
396398
- The server-side sessions feature requires a new table ([more details](https://github.com/DuendeSoftware/products/pull/743)).
397399
- The session coordination feature adds a column to the `Clients` table ([more details](https://github.com/DuendeSoftware/products/pull/820)).
398400
- 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
403405
- `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`.
404406
- `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.
405407

406-
- The `ServerSideSession` entity now uses a 64-bit long as its primary key.
407408
- Two new properties have been added to the `Client` model:
408409
- `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.
409410
- `Client.PushedAuthorizationLifetime` is a new nullable integer property that controls the lifetime of pushed
410411
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.
411412
- A new `PushedAuthorizationRequest` table has been added to store pushed authorization requests.
412413

413-
In this section, we'll look at updating the database schema based on the stores provided in the `Duende.IdentityServer.EntityFramework` package.
414-
415414
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).
416415
Note that you may want to change the database migration paths in the examples below to match your project structure.
417416

@@ -441,7 +440,7 @@ Note that you may want to change the database migration paths in the examples be
441440

442441
### Step 6: Migrate Signing Keys <Badge text="Optional" variant="note" size="small" />
443442

444-
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.
445444

446445
:::tip[Determine if you are using a custom signing key]
447446
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
453452
- 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.
454453
- 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.
455454

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).
480-
481-
### Step 8: Validate Your Deployment
455+
### Step 7: Validate Your Deployment
482456

483457
Congratulations! Your upgrade is complete.
484458

0 commit comments

Comments
 (0)