Skip to content

Commit 5f4515f

Browse files
author
gitName
committed
[APIM] Token validation and decryption key example
1 parent dfe6da4 commit 5f4515f

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

articles/api-management/validate-jwt-policy.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ author: dlepow
66

77
ms.service: azure-api-management
88
ms.topic: article
9-
ms.date: 09/27/2024
9+
ms.date: 01/27/2025
1010
ms.author: danlep
1111
---
1212

1313
# Validate JWT
1414

1515
[!INCLUDE [api-management-availability-all-tiers](../../includes/api-management-availability-all-tiers.md)]
1616

17-
The `validate-jwt` policy enforces existence and validity of a supported JSON web token (JWT) extracted from a specified HTTP header, extracted from a specified query parameter, or matching a specific value.
17+
The `validate-jwt` policy enforces existence and validity of a supported JSON web token (JWT) that was provided by an identity provider. The JWT can be extracted from a specified HTTP header, extracted from a specified query parameter, or matching a specific value.
1818

1919
> [!NOTE]
20-
> To validate a JWT that was provided by the Microsoft Entra service, API Management also provides the [`validate-azure-ad-token`](validate-azure-ad-token-policy.md) policy.
20+
> To validate a JWT that was provided specifically by the Microsoft Entra service, API Management also provides the [`validate-azure-ad-token`](validate-azure-ad-token-policy.md) policy.
2121
2222
[!INCLUDE [api-management-policy-form-alert](../../includes/api-management-policy-form-alert.md)]
2323

@@ -206,6 +206,32 @@ The `validate-jwt` policy enforces existence and validity of a supported JSON we
206206
</validate-jwt>
207207
```
208208

209+
### Token validation using decryption key
210+
211+
This example shows how to use the `validate-jwt` policy to validate a token that is decrypted using a decryption key. The key is specified using the ID of an uploaded certificate (in PFX format) that contains the public key.
212+
213+
```xml
214+
<validate-jwt header-name="Authorization" require-scheme="Bearer" output-token-variable-name="jwt">
215+
<issuer-signing-keys>
216+
<key>{{jwt-signing-key}}</key> <!-- signing key is stored in a named value -->
217+
</issuer-signing-keys>
218+
<audiences>
219+
<audience>@(context.Request.OriginalUrl.Host)</audience>
220+
</audiences>
221+
<issuers>
222+
<issuer>contoso.com</issuer>
223+
</issuers>
224+
<required-claims>
225+
<claim name="group" match="any">
226+
<value>finance</value>
227+
<value>logistics</value>
228+
</claim>
229+
</required-claims>
230+
<decryption-keys>
231+
<key certificate-id="my-certificate-in-api-management" /> <!-- decryption key specified as certificate ID -->
232+
</decryption-keys>
233+
</validate-jwt>
234+
```
209235

210236
### Authorize access to operations based on token claims
211237

0 commit comments

Comments
 (0)