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
Delegation enables your website to own the user data and perform custom validation. With delegation, you can handle developer sign-in/sign-up (and related account management operations) and product subscription using your existing website, instead of the developer portal's built-in functionality.
17
+
Delegation enables your website to own the user data and perform custom validation for users of the developer portal. With delegation, you can handle developer sign-in and sign-up (and related account management operations) and product subscription by using your existing website, instead of the developer portal's built-in functionality.
18
18
19
19
## Delegating developer sign-in and sign-up
20
20
21
-
To delegate developer sign-in and sign-up and developer account management options to your existing website, create a special delegation endpoint on your site. This special delegation acts as the entry-point for any sign-in/sign-up and related requests initiated from the API Management developer portal.
21
+
To delegate developer sign-in and sign-up and developer account management options to your existing website, create a special delegation endpoint on your site. This special delegation acts as the entrypoint for any sign-in/sign-up and related requests initiated from the API Management developer portal.
22
22
23
-
The final workflow will be:
23
+
The final workflow consists of these steps:
24
24
25
-
1. Developer clicks on the sign-in or sign-up link or an account management link at the API Management developer portal.
25
+
1. Developer clicks the sign-in or sign-up link or an account management link at the API Management developer portal.
26
26
1. Browser redirects to the delegation endpoint.
27
27
1. Delegation endpoint in return redirects user to or presents user with sign-in/sign-up or account management UI.
28
28
1. After the operation completes, user is redirected back to the API Management developer portal at the location they left.
29
29
30
-
### Set up API Management to route requests via delegation endpoint
30
+
### Set up API Management to route requests through a delegation endpoint
31
31
32
-
1. In the [Azure portal](https://portal.azure.com), navigate to your API Management instance.
33
-
1. In the left menu, under **Developer portal**, select **Delegation**.
34
-
1. Click the checkbox to enable **Delegate sign-in & sign-up**.
32
+
1. In the [Azure portal](https://portal.azure.com), go to your API Management instance.
33
+
1. In the sidebar menu, under **Developer portal**, select **Delegation**.
34
+
1. Select the checkbox to **Enable delegation**.
35
+
1. Select the checkbox to enable **Delegate sign-in & sign-up**.
35
36
36
-
:::image type="content" source="media/api-management-howto-setup-delegation/api-management-delegation-signin-up.png" alt-text="Screenshot showing delegation of sign-in and sign-up in the portal.":::
37
+
:::image type="content" source="media/api-management-howto-setup-delegation/api-management-delegation-sign-in-up.png" alt-text="Screenshot showing delegation of sign-in and sign-up in the portal.":::
37
38
38
-
1. Decide your special delegation endpoint's URL and enter it in the **Delegation endpoint URL** field.
39
-
1. Within the **Delegation Validation Key** field, either:
40
-
* Enter a secret used to compute a signature provided for verification that the request originates from API Management.
41
-
* Click the **Generate** button for API Management to generate a random key for you.
42
-
1. Click **Save**.
39
+
1. Choose the URL for your special delegation endpoint and enter it in the **Delegation service endpoint** field.
40
+
1. In **Delegation keys**:
41
+
* Generate the **Primary validation key** or **Secondary validation key** (or both) to use by your delegation service to validate requests from API Management. Select the ellipsis (**...**) next to either key and then select **Regenerate**.
42
+
* Select the ellipsis (**...**) next to either key and then select **Copy**. Copy the keys to a secure location, and use them when configuring your delegation service.
43
+
1. Select **Save**.
44
+
45
+
> [!TIP]
46
+
> You can rotate and regenerate the delegation validation keys at any time. Rotation replaces the primary key with the secondary key, and regenerates the secondary key. After saving the keys, make sure to update your delegation service to use the new keys.
43
47
44
48
### Create your delegation endpoint
45
49
46
-
Recommended steps for creating a new delegation endpoint to implement on your site:
50
+
To create a new delegation endpoint to implement on your site, follow these steps:
47
51
48
52
1. Receive a request in the following form, depending on the operation:
49
53
@@ -97,22 +101,22 @@ Recommended steps for creating a new delegation endpoint to implement on your si
97
101
98
102
## Delegating product subscription
99
103
100
-
Delegating product subscriptions works similarly to delegating user sign-in/sign-up. The final workflow would be as follows:
104
+
Delegating product subscriptions works similarly to delegating user sign-in/sign-up. The final workflow consists of these steps:
101
105
102
-
1. Developer selects a product in the API Management developer portal and clicks on the **Subscribe** button.
106
+
1. Developer selects a product in the API Management developer portal and selects the **Subscribe** button.
103
107
1. Browser redirects to the delegation endpoint.
104
-
1. Delegation endpoint performs required product subscription steps, which you design. They may include:
108
+
1. Delegation endpoint performs required product subscription steps, which you design. These steps could include:
105
109
* Redirecting to another page to request billing information.
106
-
* Asking additional questions.
110
+
* Asking further questions.
107
111
* Storing the information and not requiring any user action.
108
112
109
113
### Enable the API Management functionality
110
114
111
-
On the **Delegation** page, click**Delegate product subscription**.
115
+
On the **Delegation** page, select the checkbox to **Enable delegation**, and then enable**Delegate product subscription**.
112
116
113
117
### Create your delegation endpoint
114
118
115
-
Recommended steps for creating a new delegation endpoint to implement on your site:
119
+
To create a new delegation endpoint for your site, follow these steps:
116
120
117
121
1. Receive a request in the following form, depending on the operation.
118
122
@@ -127,14 +131,14 @@ Recommended steps for creating a new delegation endpoint to implement on your si
127
131
128
132
| Parameter | Description |
129
133
| --------- | ----------- |
130
-
|**operation**| Identifies the delegation request type. Valid product subscription requests options are: <ul><li>**Subscribe**: a request to subscribe the user to a given product with provided ID (see below).</li><li>**Unsubscribe**: a request to unsubscribe a user from a product</li></ul> |
134
+
|**operation**| Identifies the delegation request type. Valid product subscription request options are: <ul><li>**Subscribe**: a request to subscribe the user to a given product with provided ID (see below).</li><li>**Unsubscribe**: a request to unsubscribe a user from a product</li></ul> |
131
135
|**productId**| On *Subscribe*, the product ID that the user requested subscription. |
132
136
|**userId**| On *Subscribe*, the requesting user's ID. |
133
137
|**subscriptionId**| On *Unsubscribe*, the product subscription ID. |
134
138
|**salt**| A special salt string used for computing a security hash. |
135
139
|**sig**| A computed security hash used for comparison to your own computed hash. |
136
140
137
-
1. Verify that the request is coming from Azure API Management (optional, but highly recommended for security)
141
+
1. Verify that the request comes from Azure API Management (optional, but highly recommended for security).
138
142
139
143
* Compute an HMAC-SHA512 of a string based on the **productId** and **userId** (or **subscriptionId**) and **salt** query parameters:
140
144
@@ -148,16 +152,16 @@ Recommended steps for creating a new delegation endpoint to implement on your si
148
152
HMAC(salt + '\n' + subscriptionId)
149
153
```
150
154
151
-
* Compare the above-computed hash to the value of the **sig** query parameter. If the two hashes match, move on to the next step. Otherwise, deny the request.
155
+
* Compare the above-computed hash to the value of the **sig** query parameter. If the two hashes match, move to the next step. Otherwise, deny the request.
152
156
1. Process the product subscription based on the operation type requested in **operation** (for example: billing, further questions, etc.).
153
157
1. After completing the operation on your side, manage the subscription in API Management. For example, subscribe the user to the API Management product by [calling the REST API for subscriptions].
154
158
155
159
## Example code
156
160
157
-
These code samples show how to generate the hash of the `returnUrl` query parameter when delegating user sign-in or sign-up. The `returnUrl` is the URL of the page where the user clicked on the sign-in or sign-up link.
161
+
These code samples show how to generate the hash of the `returnUrl` query parameter when delegating user sign-in or sign-up. The `returnUrl` is the URL of the page where the user clicked the sign-in or sign-up link.
158
162
159
-
* Take the *delegation validation key*, which is set in the **Delegation** screen of the Azure portal.
160
-
* Create an HMAC, which validates the signature, proving the validity of the passed returnUrl.
163
+
* Take the *delegation validation key*, which you set in the **Delegation** screen of the Azure portal.
164
+
* Create an HMAC, which validates the signature and proves the validity of the passed `returnUrl`.
161
165
162
166
With slight modification, you can use the same code to calculate other hashes, such as with `productId` and `userId` when delegating product subscription.
163
167
@@ -199,8 +203,8 @@ var signature = digest.toString('base64');
199
203
> You need to [republish the developer portal](developer-portal-overview.md#publish-the-portal) for the delegation changes to take effect.
200
204
201
205
## Related content
202
-
-[Learn more about the developer portal.](api-management-howto-developer-portal.md)
203
-
-[Authenticate using Microsoft Entra ID](api-management-howto-aad.md) or with [Microsoft Entra External ID](/entra/external-id/customers/overview-customers-ciam).
206
+
-[Learn more about the developer portal](api-management-howto-developer-portal.md)
207
+
-[Authenticate using Microsoft Entra ID](api-management-howto-aad.md) or with [Microsoft Entra External ID](/entra/external-id/customers/overview-customers-ciam)
204
208
- More developer portal questions? [Find answers in our FAQ](developer-portal-faq.md).
205
209
206
210
[Delegating developer sign-in and sign-up]: #delegate-signin-up
0 commit comments