You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Configure a JWT validation policy to pre-authorize requests
277
278
278
-
## Configure policy to pre-authorize the OAuth 2.0 token
279
-
280
-
The configuration up to now enables the developer portal to obtain an OAuth 2.0 token and pass it to the backend API. However, the API can still be called without an OAuth 2.0 token.
281
-
282
-
You can configure a `validate-jwt` policy to pre-authorize the token, so that API Management blocks requests that do not include a valid token from the OAuth 2.0 provider.
283
-
284
-
Add the following `validate-jwt` policy to the Inbound section at a scope that's appropriate to protect the API.
285
-
286
-
* In `openid-config`, enter the URL the OpenID Connect metadata endpoint configured in your app registration. The example shown assumes a single-tenant Azure AD app with tenant ID `aad-tenant` and a v2 configuration endpoint.
287
-
* In the `claim` value, enter the client (application) ID of the backend-app you configured.
279
+
In the preceding section, API Management doesn't validate the access token. It only passes the token in the authorization header to the backend API.
288
280
281
+
To pre-authorize requests, configure a [validate-jwt](api-management-access-restriction-policies.md#ValidateJWT) policy to validate the access token of each incoming request. If a request doesn't have a valid token, API Management blocks it.
289
282
290
-
```xml
291
-
<validate-jwtheader-name="Authorization"failed-validation-httpcode="401"failed-validation-error-message="Unauthorized. Access token is missing or invalid.">
## Developer portal - test the OAuth 2.0 user authorization
302
286
@@ -332,13 +316,6 @@ Once you've signed in, the **Request headers** are populated with an `Authorizat
332
316
333
317
At this point you can configure the desired values for the remaining parameters, and submit the request.
334
318
335
-
## Configure a JWT validation policy to pre-authorize requests
336
-
337
-
In the preceding section, API Management doesn't validate the access token. It only passes the token in the authorization header to the backend API.
338
-
339
-
To pre-authorize requests, configure a [validate-jwt](api-management-access-restriction-policies.md#ValidateJWT) policy to validate the access token of each incoming request. If a request doesn't have a valid token, API Management blocks it.
Copy file name to clipboardExpand all lines: includes/api-management-configure-validate-jwt.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ ms.author: danlep
8
8
9
9
The following example policy, when added to the `<inbound>` policy section, checks the value of the audience claim in an access token obtained from Azure AD that is presented in the Authorization header. It returns an error message if the token is not valid. Configure this policy at a policy scope that's appropriate for your scenario.
10
10
11
-
* In `openid-config`, the `aad-tenant` is the tenant ID in Azure AD. Find this value in the Azure portal, for example, on the **Overview** page of your Azure AD resource.
11
+
* In `openid-config`, the `aad-tenant` is the tenant ID in Azure AD. Find this value in the Azure portal, for example, on the **Overview** page of your Azure AD resource. The example shown assumes a single-tenant Azure AD app and a v2 configuration endpoint.
12
12
* The value of the `claim` is the client ID of the backend-app you registered in Azure AD.
0 commit comments