Skip to content

Commit bea6ba1

Browse files
committed
Removing postman testing instructions
1 parent b1ba293 commit bea6ba1

File tree

1 file changed

+0
-103
lines changed

1 file changed

+0
-103
lines changed

articles/active-directory-b2c/secure-api-management.md

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ Before you begin, make sure that you have the following resources in place:
2929
* An [application that's registered in your tenant](tutorial-register-applications.md)
3030
* [User flows that are created in your tenant](tutorial-create-user-flows.md)
3131
* A [published API](../api-management/import-and-publish.md) in Azure API Management
32-
* (Optional) A [Postman platform](https://www.postman.com/) to test secured access
3332

3433
## Get Azure AD B2C application ID
3534

@@ -114,108 +113,6 @@ You're now ready to add the inbound policy in Azure API Management that validate
114113
<on-error> <base /> </on-error>
115114
</policies>
116115
```
117-
118-
## Validate secure API access
119-
120-
To ensure that only authenticated callers can access your API, you can validate your Azure API Management configuration by calling the API with [Postman](https://www.postman.com/).
121-
122-
To call the API, you need both an access token that's issued by Azure AD B2C and an Azure API Management subscription key.
123-
124-
### Get an access token
125-
126-
You first need a token that's issued by Azure AD B2C to use in the `Authorization` header in Postman. You can get one by using the *Run now* feature of the sign-up/sign-in user flow you that you created as one of the prerequisites.
127-
128-
1. In the [Azure portal](https://portal.azure.com), go to your Azure AD B2C tenant.
129-
1. Under **Policies**, select **User flows**.
130-
1. Select an existing sign-up/sign-in user flow (for example, *B2C_1_signupsignin1*).
131-
1. For **Application**, select *webapp1*.
132-
1. For **Reply URL**, select `https://jwt.ms`.
133-
1. Select **Run user flow**.
134-
135-
![Screenshot of the "Run user flow" pane for the sign-up/sign-in user flow in the Azure portal.](media/secure-apim-with-b2c-token/portal-03-user-flow.png)
136-
137-
1. Complete the sign-in process. You should be redirected to `https://jwt.ms`.
138-
1. Record the encoded token value that's displayed in your browser. You use this token value for the Authorization header in Postman.
139-
140-
![Screenshot of the encoded token value displayed on jwt.ms.](media/secure-apim-with-b2c-token/jwt-ms-01-token.png)
141-
142-
### Get an API subscription key
143-
144-
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:
145-
146-
1. In the [Azure portal](https://portal.azure.com), go to your Azure API Management service instance.
147-
1. Select **Subscriptions**.
148-
1. Select the ellipsis (**...**) next to **Product: Unlimited**, and then select **Show/hide keys**.
149-
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.
150-
151-
![Screenshot of the "Subscription key" page in the Azure portal, with "Show/hide keys" selected.](media/secure-apim-with-b2c-token/portal-04-api-subscription-key.png)
152-
153-
### Test a secure API call
154-
155-
With the access token and Azure API Management subscription key recorded, you're now ready to test whether you've correctly configured secure access to the API.
156-
157-
1. Create a new `GET` request in [Postman](https://www.postman.com/). For the request URL, specify the speakers list endpoint of the API you published as one of the prerequisites. For example:
158-
159-
`https://contosoapim.azure-api.net/conference/speakers`
160-
161-
1. Next, add the following headers:
162-
163-
| Key | Value |
164-
| --- | ----- |
165-
| `Authorization` | The encoded token value you recorded earlier, prefixed with `Bearer ` (include the space after "Bearer") |
166-
| `Ocp-Apim-Subscription-Key` | The Azure API Management subscription key you recorded earlier. |
167-
| | |
168-
169-
Your **GET** request URL and **Headers** should appear similar to those shown in the following image:
170-
171-
![Screenshot of the Postman UI showing the GET request URL and headers.](media/secure-apim-with-b2c-token/postman-01-headers.png)
172-
173-
1. In Postman, select the **Send** button to execute the request. If you've configured everything correctly, you should be given a JSON response with a collection of conference speakers (shown here, truncated):
174-
175-
```json
176-
{
177-
"collection": {
178-
"version": "1.0",
179-
"href": "https://conferenceapi.azurewebsites.net:443/speakers",
180-
"links": [],
181-
"items": [
182-
{
183-
"href": "https://conferenceapi.azurewebsites.net/speaker/1",
184-
"data": [
185-
{
186-
"name": "Name",
187-
"value": "Scott Guthrie"
188-
}
189-
],
190-
"links": [
191-
{
192-
"rel": "http://tavis.net/rels/sessions",
193-
"href": "https://conferenceapi.azurewebsites.net/speaker/1/sessions"
194-
}
195-
]
196-
},
197-
[...]
198-
```
199-
200-
### Test an insecure API call
201-
202-
Now that you've made a successful request, test the failure case to ensure that calls to your API with an *invalid* token are rejected as expected. One way to perform the test is to add or change a few characters in the token value, and then run the same `GET` request as before.
203-
204-
1. Add several characters to the token value to simulate an invalid token. For example, you could add "INVALID" to the token value, as shown here:
205-
206-
![Screenshot of the Headers section of Postman UI showing the string INVALID added to token.](media/secure-apim-with-b2c-token/postman-02-invalid-token.png)
207-
208-
1. Select the **Send** button to execute the request. With an invalid token, the expected result is a `401` unauthorized status code:
209-
210-
```json
211-
{
212-
"statusCode": 401,
213-
"message": "Unauthorized. Access token is missing or invalid."
214-
}
215-
```
216-
217-
If you see a `401` status code, 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.
218-
219116
## Support multiple applications and issuers
220117

221118
Several applications typically interact with a single REST API. To enable your API to accept tokens intended for multiple applications, add their application IDs to the `<audiences>` element in the Azure API Management inbound policy.

0 commit comments

Comments
 (0)