Skip to content

Commit 34a1080

Browse files
committed
Add docs about strict audience validation for private key JWT
1 parent 5ddd74b commit 34a1080

File tree

2 files changed

+46
-3
lines changed

2 files changed

+46
-3
lines changed

IdentityServer/v7/docs/content/reference/options.md

+22-3
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,26 @@ Alternatively, you can suppress the warning at the call site:
773773
In large deployments of Duende IdentityServer, where a lot of concurrent users attempt to
774774
consume the [discovery endpoint]({{< ref "reference/endpoints/discovery" >}}) to retrieve
775775
metadata about your IdentityServer, you can increase throughput by enabling the
776-
discovery document cache preview. This will cache discovery document information for the
777-
duration specified in the **DiscoveryDocumentCacheDuration** option.
776+
discovery document cache preview using the **EnableDiscoveryDocumentCache** flag.
777+
This will cache discovery document information for the duration specified in the
778+
**DiscoveryDocumentCacheDuration** option.
778779

779-
The `DUENDEPREVIEW0001` diagnostic is reported when using the discovery endpoint cache.
780+
It's best to keep the cache time low if you use the `CustomEntries` element on the
781+
discovery document or implement a custom `IDiscoveryResponseGenerator`.
782+
783+
The `DUENDEPREVIEW0001` diagnostic is reported when using the discovery endpoint cache.
784+
785+
#### DUENDEPREVIEW0002
786+
787+
When using [*private key JWT*]({{< ref "/tokens/authentication/jwt" >}}),
788+
there is a theoretical vulnerability where a Relying Party trusting multiple OpenID Providers
789+
could be attacked if one of the OpenID Providers is malicious or compromised.
790+
791+
The OpenID Foundation proposed a two-part fix: strictly validate the audience and set an
792+
explicit `typ` header in the authentication JWT.
793+
794+
You can [enable strict audience validation in Duende IdentityServer]({{< ref "/tokens/authentication/jwt#strict-audience-validation" >}})
795+
using the **StrictClientAssertionAudienceValidation** flag, which strictly validates that
796+
the audience is equal to the issuer and validates the token's `typ` header.
797+
798+
The `DUENDEPREVIEW0002` diagnostic is reported when using Strict Audience Validation.

IdentityServer/v7/docs/content/tokens/authentication/jwt.md

+24
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,27 @@ public class OidcEvents : OpenIdConnectEvents
165165

166166
The assertion service would be a helper to create the JWT as shown above in the *CreateClientToken* method.
167167
See [here]({{< ref "/samples/basics#mvc-client-with-jar-and-jwt-based-authentication" >}}) for a sample for using JWT-based authentication (and signed authorize requests) in ASP.NET Core.
168+
169+
## Strict Audience Validation
170+
171+
Private key JWT have a theoretical vulnerability where a Relying Party trusting multiple
172+
OpenID Providers could be attacked if one of the OpenID Providers is malicious or compromised.
173+
174+
The attack relies on the OpenID Provider setting the audience value of the authentication JWT
175+
to the token endpoint based on the token endpoint value found in the discovery document.
176+
The malicious Open ID Provider can attack this because it controls what the discovery document
177+
contains, and can fool the Relying Party into creating authentication JWTs for the audience of
178+
a victim OpenID Provider.
179+
180+
The OpenID Foundation proposed a two-part fix: strictly validate the audience and set an
181+
explicit `typ` header in the authentication JWT.
182+
183+
You can enable strict audience validation using the [**StrictClientAssertionAudienceValidation**]({{< ref "/reference/options/#duendepreview0002" >}})
184+
flag, which strictly validates that the audience is equal to the issuer and validates the token's
185+
`typ` header.
186+
187+
Validation behavior is determined based on the `typ` header being present.
188+
If the **StrictClientAssertionAudienceValidation** flag is not set but the token sets the `typ`
189+
to `client-authentication+jwt`, then the audience will still be validated strictly.
190+
If `typ` is not present, [default audience validation]({{< ref "/apis/aspnetcore/jwt/#adding-audience-validation" >}})
191+
is used.

0 commit comments

Comments
 (0)