Skip to content

Commit 8d7d53f

Browse files
authored
Merge pull request #987 from DuendeSoftware/mb/fix
Update IdentityServer upgrade guide with improved application name handling
2 parents 936eef6 + 11a4228 commit 8d7d53f

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,8 @@ pnpm-debug.log*
2222
.DS_Store
2323
.vscode/settings.json
2424
*.iml
25+
26+
# Agents and assistants
27+
.opencode/
28+
opencode.json
2529
.idea/**/copilot.data.migration.*.xml

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -534,12 +534,20 @@ In your current (pre-upgraded) IdentityServer version, you can query the applica
534534
var app = builder.Build();
535535

536536
// ...
537-
var applicationName = app.Services
538-
.GetRequiredService<IOptions<DataProtectionOptions>>()
539-
.Value.ApplicationDiscriminator;
540-
537+
var applicationName = "";
538+
var applicationDiscriminatorService = app.Services.GetService<IApplicationDiscriminator>();
539+
if (applicationDiscriminatorService != null)
540+
{
541+
applicationName = applicationDiscriminatorService.Discriminator;
542+
}
543+
var dataProtectionOptions = app.Services.GetService<IOptions<DataProtectionOptions>>();
544+
if (dataProtectionOptions != null && dataProtectionOptions.Value.ApplicationDiscriminator != null)
545+
{
546+
dataProtectionApplicationDiscriminator = dataProtectionOptions.Value.ApplicationDiscriminator;
547+
}
548+
541549
// applicationName is now the (auto-generated?) application name
542-
// - you can use it in your upgraded IdentityServer version
550+
// - you can use its value in your upgraded IdentityServer version
543551
```
544552

545553
:::

0 commit comments

Comments
 (0)