Skip to content

Commit 1f0ce10

Browse files
committed
removed duplicate content
1 parent 1f2e1ac commit 1f0ce10

File tree

2 files changed

+5
-28
lines changed

2 files changed

+5
-28
lines changed

articles/api-management/api-management-howto-oauth2.md

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -274,29 +274,13 @@ After saving the OAuth 2.0 server configuration, configure an API or APIs to use
274274

275275
:::image type="content" source="./media/api-management-howto-oauth2/oauth-07.png" alt-text="Configure OAuth 2.0 authorization server":::
276276

277+
## Configure a JWT validation policy to pre-authorize requests
277278

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.
288280

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.
289282

290-
```xml
291-
<validate-jwt header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized. Access token is missing or invalid.">
292-
<openid-config url="https://login.microsoftonline.com/{aad-tenant}/v2.0/.well-known/openid-configuration" />
293-
<required-claims>
294-
<claim name="aud">
295-
<value>{backend-app-client-id}</value>
296-
</claim>
297-
</required-claims>
298-
</validate-jwt>
299-
```
283+
[!INCLUDE [api-management-configure-validate-jwt](../../includes/api-management-configure-validate-jwt.md)]
300284

301285
## Developer portal - test the OAuth 2.0 user authorization
302286

@@ -332,13 +316,6 @@ Once you've signed in, the **Request headers** are populated with an `Authorizat
332316

333317
At this point you can configure the desired values for the remaining parameters, and submit the request.
334318

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.
340-
341-
[!INCLUDE [api-management-configure-validate-jwt](../../includes/api-management-configure-validate-jwt.md)]
342319

343320
## Next steps
344321

includes/api-management-configure-validate-jwt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.author: danlep
88

99
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.
1010

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.
1212
* The value of the `claim` is the client ID of the backend-app you registered in Azure AD.
1313

1414

0 commit comments

Comments
 (0)