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 claims validation in Azure API Management
64
+
## Configure inbound policy in Azure API Management
65
65
66
-
You're now ready to add the inbound policy in Azure API Management that validates API calls. By adding an inbound policy that verifies the audience and issuer claims in an access token, you can ensure that only API calls with a valid token are accepted.
66
+
You're now ready to add the inbound policy in Azure API Management that validates API calls. By adding a [JWT validation](../api-management/api-management-access-restriction-policies.md#ValidateJWT)policy that verifies the audience and issuer in an access token, you can ensure that only API calls with a valid token are accepted.
67
67
68
68
1. Browse to your Azure API Management instance in the [Azure portal](https://portal.azure.com)
69
69
1. Select **APIs**
@@ -72,23 +72,21 @@ You're now ready to add the inbound policy in Azure API Management that validate
72
72
1. Under **Inbound processing**, select **\</\>** to open the policy code editor
73
73
1. Place the following `<validate-jwt>` tag inside the `<inbound>` policy.
74
74
75
-
1. Update the `url` value in the `<openid-config>`tag with your policy's well-known configuration URL.
76
-
1. Update the `aud` value with Application ID of the application you created previously in your B2C tenant (for example, *webapp1*).
77
-
1. Update the `iss` value with the token issuer endpoint you recorded earlier.
75
+
1. Update the `url` value in the `<openid-config>`element with your policy's well-known configuration URL.
76
+
1. Update the `<audience>` element with Application ID of the application you created previously in your B2C tenant (for example, *webapp1*).
77
+
1. Update the `<issuer>` element with the token issuer endpoint you recorded earlier.
78
78
79
79
```xml
80
80
<policies>
81
81
<inbound>
82
82
<validate-jwtheader-name="Authorization"failed-validation-httpcode="401"failed-validation-error-message="Unauthorized. Access token is missing or invalid.">
@@ -124,12 +122,12 @@ You first need a token issued by Azure AD B2C to use in the `Authorization` head
124
122
125
123
### Get API subscription key
126
124
127
-
A client application (in this case, Postman) that calls a published API must include a valid API Management subscription key in its HTTP requests. To get a subscription key to include in your Postman HTTP request:
125
+
A client application (in this case, Postman) that calls a published API must include a valid API Management subscription key in its HTTP requests to the API. To get a subscription key to include in your Postman HTTP request:
128
126
129
127
1. Browse to your Azure API Management service instance in the [Azure portal](https://portal.azure.com)
130
128
1. Select **Subscriptions**
131
129
1. Select the ellipsis for **Product: Unlimited**, then select **Show/hide keys**
132
-
1. Record the **PRIMARY KEY** for the product. You use this for the `Ocp-Apim-Subscription-Key` header in your HTTP request in Postman.
130
+
1. Record the **PRIMARY KEY** for the product. You use this key for the `Ocp-Apim-Subscription-Key` header in your HTTP request in Postman.
133
131
134
132

135
133
@@ -139,9 +137,7 @@ With the access token and APIM subscription key recorded, you're now ready to te
139
137
140
138
1. Create a new `GET` request in [Postman](https://www.getpostman.com/). For the request URL, specify the speakers list endpoint of the API you published as one of the prerequisites. For example:
@@ -198,12 +194,66 @@ Now that you've made a successful request, test the failure case to ensure that
198
194
}
199
195
```
200
196
201
-
Congratulations! You've just verified that only callers with a valid access token issued by Azure AD B2C can make successful requests to your Azure API Management API.
197
+
Congratulations! You've verified that only callers with a valid access token issued by Azure AD B2C can make successful requests to your Azure API Management API.
202
198
203
-
## Next steps
199
+
## Support multiple applications and issuers
200
+
201
+
Several applications typically interact with a single REST API. To allow multiple applications to call your API, add their application IDs to the `<audiences>` element in the APIM inbound policy.
202
+
203
+
```XML
204
+
<!-- Accept requests from multiple applications -->
If you have an APIM API that validates tokens issued by the legacy `login.microsoftonline.com` endpoint, you should migrate the API and the applications that call it to use tokens issued by [b2clogin.com](b2clogin.md).
224
+
225
+
You can follow this general process to perform a staged migration:
226
+
227
+
1. Add support in your APIM inbound policy for tokens issued by both b2clogin.com and login.microsoftonline.com.
228
+
1. Update your applications one at a time to obtain tokens from the b2clogin.com endpoint.
229
+
1. Once all of your applications are correctly obtaining tokens from b2clogin.com, remove support for login.microsoftonline.com-issued tokens from the API.
230
+
231
+
The following example APIM inbound policy illustrates how to accept tokens issued by both b2clogin.com login.microsoftonline.com. Additionally, it supports API requests from two applications.
232
+
233
+
```XML
234
+
<policies>
235
+
<inbound>
236
+
<validate-jwtheader-name="Authorization"failed-validation-httpcode="401"failed-validation-error-message="Unauthorized. Access token is missing or invalid.">
If you have a currently deployed API in Azure API Management that's configured with a secure access policy accepting tokens from the legacy `login.microsoftonline.com` issuer endpoint, you should migrate the API and its client applications to use the recommended `b2clogin.com` issuer. During such a migration, you might need to support tokens issued by both endpoints to allow for a staged migration of your client applications to `b2clogin.com`.
257
+
For additional details on Azure API Management policies, see the [APIM policy reference index](../api-management/api-management-policies.md).
208
258
209
-
[Migrate an Azure API Management API to b2clogin.com](multiple-token-endpoints-apim.md)
259
+
You can find information about migrating OWIN-based web APIs and their applications to b2clogin.com in [Migrate an OWIN-based web API to b2clogin.com](multiple-token-endpoints.md).
0 commit comments