Skip to content

Commit 23a7480

Browse files
committed
Update IdentityServer upgrade guide with improved application name handling
1 parent fbd02f5 commit 23a7480

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ pnpm-debug.log*
2121
# macOS-specific files
2222
.DS_Store
2323
.vscode/settings.json
24-
*.iml
24+
*.iml
25+
26+
.opencode/
27+
opencode.json

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)