Skip to content

Commit 6ce179c

Browse files
committed
Moved some of the Data Protection content back to the IdentityServer page, specifically the IdentityServer specific content. Also some rewording for simplicity or spelling fixes.
1 parent f14ec70 commit 6ce179c

2 files changed

Lines changed: 42 additions & 54 deletions

File tree

astro/src/content/docs/general/data-protection.md

Lines changed: 8 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ Data Protection in any Duende server-side application makes extensive use of ASP
2424
In local development, ASP.NET automatically creates data protection keys, but in a deployed environment, you will need
2525
to ensure that your data protection keys are stored in a persistent way and shared across all load balanced instances of
2626
your implementation. This means you'll need to choose where to store and how to protect the data
27-
protection keys, as appropriate for your environment. Microsoft has extensive
28-
documentation [here](https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/configuration/overview)
27+
protection keys, as appropriate for your environment. Microsoft has [extensive
28+
documentation](https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/configuration/overview)
2929
describing how to configure storage and protection of data protection keys.
3030

3131
A typical implementation should include data protection configuration code, like this:
@@ -48,41 +48,17 @@ builder.Services.AddDataProtection()
4848

4949
:::danger[Ensure data protection keys are persisted]
5050
Always make sure data protection is configured to persist data protection keys to storage, using `.PersistKeys...()`
51-
for your storage mechanism.
51+
for your storage mechanism. If you lose your data protection keys, all data protected with those keys is no longer be readable.
5252

53-
In addition, make sure the storage mechanism itself is durable. For example, if you are using the default file system
53+
Additionally ensure the storage mechanism itself is durable. For example, if you are using the default file system
5454
based key store, make sure that the configured path is not stored on ephemeral storage. If you are using Redis to store
55-
data protection keys using `PersistKeysToStackExchangeRedis`, ensure that your Redis service is configured to persist
56-
data to a database backup or append-only file. Otherwise, when your Redis instance reboots, you will lose all data
57-
protection keys.
55+
data protection keys using `PersistKeysToStackExchangeRedis()`, ensure that your Redis service is configured to persist
56+
data to a database backup or append-only file. Otherwise you will lose all data
57+
protection keys when your Redis instance reboots.
5858

59-
If you lose your data protection keys, all data protected with those keys is no longer be readable.
59+
For a more advanced setup, you can create a [key escrow sink](https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/extensibility/key-management?view=aspnetcore-10.0#xmlkeymanager), allowing you to store new data protection keys into a secure storage (e.g., Azure Key Vault) before the new keys are encrypted. This enables you to restore existing data protection keys in case they become corrupted or lost.
6060
:::
6161

62-
## ASP.NET Data Protection Keys and IdentityServer Signing Keys
63-
64-
ASP.NET's data protection keys are sometimes confused with IdentityServer's signing keys, but the two are completely
65-
separate keys with different purposes. IdentityServer implementations need both to function correctly.
66-
67-
### ASP.NET Data Protection Keys
68-
69-
Data protection is a cryptographic library that is part of ASP.NET Core. Data protection uses private key
70-
cryptography to encrypt and sign sensitive data to ensure that it is only written and read by the application. The
71-
framework uses data protection to secure data that is commonly used by IdentityServer implementations, such as
72-
authentication cookies and anti-forgery tokens. In addition, IdentityServer itself uses data protection to protect
73-
sensitive data at rest, such as persisted grants, and sensitive data passed through the browser, such as the
74-
context objects passed to pages in the UI. The data protection keys are critical secrets for an IdentityServer
75-
implementation because they encrypt a great deal of sensitive data at rest and prevent sensitive data that is
76-
round-tripped through the browser from being tampered with.
77-
78-
### The IdentityServer Signing Key
79-
80-
Separately, IdentityServer needs cryptographic keys, called [signing keys](/identityserver/fundamentals/key-management.md), to
81-
sign tokens such as JWT access tokens and id tokens. The signing keys use public key cryptography to allow client
82-
applications and APIs to validate token signatures using the public keys, which are published by IdentityServer
83-
through [discovery](/identityserver/reference/endpoints/discovery.md). The private key component of the signing keys are
84-
also critical secrets for IdentityServer because a valid signature provides integrity and non-repudiation guarantees
85-
that allow client applications and APIs to trust those tokens.
8662

8763
## Common Problems
8864

@@ -119,15 +95,3 @@ There are several ways that data protection problems can occur:
11995
key generated every time the site starts up. Microsoft's docs on this issue
12096
are [here](https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/advanced?view=aspnetcore-7.0#data-protection).
12197

122-
### Identity Server's Usage of Data Protection
123-
124-
Duende IdentityServer's features that rely on data protection include
125-
126-
* protecting signing keys at rest (if [automatic key management](/identityserver/fundamentals/key-management.md#automatic-key-management) is used and enabled)
127-
* protecting [persisted grants](/identityserver/data/operational.md#persisted-grant-service) at rest (if enabled)
128-
* protecting [server-side session](/identityserver/ui/server-side-sessions/index.md) data at rest (if enabled)
129-
* protecting [the state parameter](/identityserver/ui/login/external.md#state-url-length-and-isecuredataformat) for
130-
external OIDC providers (if enabled)
131-
* protecting message payloads sent between pages in the UI (
132-
e.g. [logout context](/identityserver/ui/logout/logout-context.md) and [error context](/identityserver/ui/error.md)).
133-
* session management (because the ASP.NET Core cookie authentication handler requires it)

astro/src/content/docs/identityserver/deployment/index.md

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,32 @@ crucial that you configure data protection correctly before you start using your
9797

9898
The recommended practices for setting up and using ASP.NET Core Data Protection for Duende IdentityServer are the same as for other server-side products, like BFF. See the [general ASP.NET Core Data Protection page](/general/data-protection).
9999

100+
### ASP.NET Data Protection Keys and IdentityServer Signing Keys
100101

101-
### Identity Server's Usage of Data Protection
102+
ASP.NET's data protection keys are sometimes confused with IdentityServer's signing keys, but the two are completely
103+
separate keys with different purposes. IdentityServer implementations need both to function correctly.
102104

103-
Duende IdentityServer's features that rely on data protection include
105+
#### ASP.NET Data Protection Keys
104106

105-
* protecting signing keys at rest (if [automatic key management](/identityserver/fundamentals/key-management.md#automatic-key-management) is used and enabled)
106-
* protecting [persisted grants](/identityserver/data/operational.md#persisted-grant-service) at rest (if enabled)
107-
* protecting [server-side session](/identityserver/ui/server-side-sessions/index.md) data at rest (if enabled)
108-
* protecting [the state parameter](/identityserver/ui/login/external.md#state-url-length-and-isecuredataformat) for
109-
external OIDC providers (if enabled)
110-
* protecting message payloads sent between pages in the UI (e.g. [logout context](/identityserver/ui/logout/logout-context.md) and [error context](/identityserver/ui/error.md))
111-
* session management (because the ASP.NET Core cookie authentication handler requires it)
107+
Data protection is a cryptographic library that is part of ASP.NET Core. Data protection uses private key
108+
cryptography to encrypt and sign sensitive data to ensure that it is only written and read by the application. The
109+
framework uses data protection to secure data that is commonly used by IdentityServer implementations, such as
110+
authentication cookies and anti-forgery tokens. In addition, IdentityServer itself uses data protection to protect
111+
sensitive data at rest, such as persisted grants, and sensitive data passed through the browser, such as the
112+
context objects passed to pages in the UI. The data protection keys are critical secrets for an IdentityServer
113+
implementation because they encrypt a great deal of sensitive data at rest and prevent sensitive data that is
114+
round-tripped through the browser from being tampered with.
115+
116+
#### The IdentityServer Signing Key
112117

113-
## IdentityServer Data Stores
118+
Separately, IdentityServer needs cryptographic keys, called [signing keys](/identityserver/fundamentals/key-management.md), to
119+
sign tokens such as JWT access tokens and id tokens. The signing keys use public key cryptography to allow client
120+
applications and APIs to validate token signatures using the public keys, which are published by IdentityServer
121+
through [discovery](/identityserver/reference/endpoints/discovery.md). The private key component of the signing keys are
122+
also critical secrets for IdentityServer because a valid signature provides integrity and non-repudiation guarantees
123+
that allow client applications and APIs to trust those tokens.
124+
125+
### IdentityServer Data Stores
114126

115127
IdentityServer itself is stateless and does not require server affinity - but there is data that needs to be shared between in multi-instance deployments.
116128

@@ -135,6 +147,18 @@ You can either use a traditional database for storing operational data, or use a
135147

136148
Duende IdentityServer includes storage implementations for above data using EntityFramework, and you can build your own. See the [data stores](/identityserver/data) section for more information.
137149

150+
### IdentityServer Features Using Data Protection
151+
152+
Duende IdentityServer's features that rely on data protection include:
153+
154+
* protecting signing keys at rest (if [automatic key management](/identityserver/fundamentals/key-management.md#automatic-key-management) is used and enabled)
155+
* protecting [persisted grants](/identityserver/data/operational.md#persisted-grant-service) at rest (if enabled)
156+
* protecting [server-side session](/identityserver/ui/server-side-sessions/index.md) data at rest (if enabled)
157+
* protecting [the state parameter](/identityserver/ui/login/external.md#state-url-length-and-isecuredataformat) for
158+
external OIDC providers (if enabled)
159+
* protecting message payloads sent between pages in the UI (e.g. [logout context](/identityserver/ui/logout/logout-context.md) and [error context](/identityserver/ui/error.md)).
160+
* session management (because the ASP.NET Core cookie authentication handler requires it)
161+
138162
## Distributed Caching
139163

140164
Some optional features rely on ASP.NET Core distributed caching:

0 commit comments

Comments
 (0)