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
The OAuth 2.0 On-Behalf-Of (OBO) flow serves the use case in which an application invokes a service/web API that in turn needs to call another service/web API. The OBO flow propagates the delegated user identity and permissions through the request chain. For the middle-tier service to make authenticated requests to the downstream service, it must secure an access token from Azure Active Directory (Azure AD) on behalf of the user.
27
+
The OAuth 2.0 On-Behalf-Of (OBO) flow enables an application that invokes a service or web API to pass user authentication to another service or web API. The OBO flow propagates the delegated user identity and permissions through the request chain. For the middle-tier service to make authenticated requests to the downstream service, it must secure an access token from Azure Active Directory (Azure AD) on behalf of the user.
28
28
29
29
> [!IMPORTANT]
30
-
> As of May 2018, an `id_token` can't be used for the On-Behalf-Of flow. Single-page apps (SPAs) must pass an **access** token to a middle-tier confidential client to perform OBO flows. See [limitations](#client-limitations) for more details about the clients that can perform On-Behalf-Of calls.
30
+
> As of May 2018, an `id_token` can't be used for the On-Behalf-Of flow. Single-page apps (SPAs) must pass an **access** token to a middle-tier confidential client to perform OBO flows. For more detail about the clients that can perform On-Behalf-Of calls, see [limitations](#client-limitations).
31
31
32
32
## On-Behalf-Of flow diagram
33
33
34
34
The OBO flow starts after the user has been authenticated on an application using the [OAuth 2.0 authorization code grant flow](v1-protocols-oauth-code.md). At that point, the application has an access token (token A) with the user’s claims and consent to access the middle-tier web API (API A). Next, API A needs to make an authenticated request to the downstream web API (API B).
35
35
36
-
The steps that follow constitute the On-Behalf-Of flow.
1. The client application makes a request to API A with the token A.
@@ -44,7 +43,7 @@ The steps that follow constitute the On-Behalf-Of flow.
44
43
1. API B returns data from the secured resource.
45
44
46
45
>[!NOTE]
47
-
>The audience claim in an access token used to request a token for a downstream service must be the id of the service making the OBO request. The token also must be signed with the Azure Active Directory global signing key (which is the default for applications registered via **App registrations** in the portal).
46
+
>The audience claim in an access token used to request a token for a downstream service must be the ID of the service making the OBO request. The token also must be signed with the Azure Active Directory global signing key (which is the default for applications registered via **App registrations** in the portal).
48
47
49
48
## Register the application and service in Azure AD
50
49
@@ -53,7 +52,7 @@ Register both the middle-tier service and the client application in Azure AD.
53
52
### Register the middle-tier service
54
53
55
54
1. Sign in to the [Azure portal](https://portal.azure.com).
56
-
1. On the top bar, select your account and look under the **Directory** list to choose the Active Directory tenant where you wish to register your application.
55
+
1. On the top bar, select your account and look under the **Directory** list to choose an Active Directory tenant for your application.
57
56
1. Select **More Services** on the left pane and choose **Azure Active Directory**.
58
57
1. Select **App registrations** and choose **New application registration**.
59
58
1. Enter a friendly name for the application and select the application type.
@@ -63,28 +62,29 @@ Register both the middle-tier service and the client application in Azure AD.
63
62
1. In the Azure portal, choose your application and select **Settings**.
64
63
1. Select **Keys** in the Settings menu and add a key with a key duration of either one year or two years.
65
64
1. When you save this page, the Azure portal displays the key value. Copy and save the key value in a safe location.
65
+
66
66
> [!IMPORTANT]
67
67
> You need the key to configure the application settings in your implementation. This key value is not displayed again nor retrievable by any other means. Record it as soon as it is visible in the Azure Portal.
68
68
69
69
### Register the client application
70
70
71
71
1. Sign in to the [Azure portal](https://portal.azure.com).
72
-
1. On the top bar, select your account and look under the **Directory** list to choose the Active Directory tenant where you wish to register your application.
72
+
1. On the top bar, select your account and look under the **Directory** list to choose an Active Directory tenant for your application.
73
73
1. Select **More Services** on the left pane and choose **Azure Active Directory**.
74
74
1. Select **App registrations** and choose **New application registration**.
75
-
1. Enter a friendly name for the application, and select the application type.
75
+
1. Enter a friendly name for the application and select the application type.
76
76
1. Depending upon the application type, set either the sign-on URL or the redirect URL to the base URL.
77
77
1. Select **Create** to create the application.
78
78
1. Configure permissions for your application.
79
-
1. In the Settings menu, choose the **Required permissions** section,and then select **Add** and **Select an API**.
79
+
1. In the Settings menu, choose the **Required permissions** section,and then select **Add** and **Select an API**.
80
80
1. Type the name of the middle-tier service in the textbox.
81
81
1. Choose **Select Permissions** and then select **Access service name**.
82
82
83
83
### Configure known client applications
84
84
85
-
In this scenario, the middle-tier service needs to obtain the user's consent to access the downstream API without a user interaction. Therefore, the option to grant access to the downstream API must be presented upfront as part of the consent step during authentication.
85
+
In this scenario, the middle-tier service needs to obtain the user's consent to access the downstream API without a user interaction. The option to grant access to the downstream API must be presented upfront as part of the consent step during authentication.
86
86
87
-
To achieve this, follow the steps below to explicitly bind the client app's registration in Azure AD with the registration of the middle-tier service. This operation merges the consent required by both the client and middle-tier into a single dialog.
87
+
Follow the steps below to explicitly bind the client app's registration in Azure AD with the middle-tier service's registration. This operation merges the consent required by both the client and middle-tier into a single dialog.
88
88
89
89
1. Go to the middle-tier service registration and select **Manifest** to open the manifest editor.
90
90
1. Locate the `knownClientApplications` array property and add the Client ID of the client application as an element.
@@ -106,17 +106,17 @@ When using a shared secret, a service-to-service access token request contains t
106
106
107
107
| Parameter || Description |
108
108
| --- | --- | --- |
109
-
| grant_type |required | The type of the token request. Since an OBO request uses a JWT access token, the value must be **urn:ietf:params:oauth:grant-type:jwt-bearer**. |
109
+
| grant_type |required | The type of the token request. Since an OBO request uses a JSON Web Token (JWT), the value must be **urn:ietf:params:oauth:grant-type:jwt-bearer**. |
110
110
| assertion |required | The value of the access token used in the request. |
111
-
| client_id |required | The App ID assigned to the calling service during registration with Azure AD. To find the App ID in the Azure Management Portal, select **Active Directory**, choose the directory, and then select the application name. |
111
+
| client_id |required | The App ID assigned to the calling service during registration with Azure AD. To find the App ID in the Azure portal, select **Active Directory**, choose the directory, and then select the application name. |
112
112
| client_secret |required | The key registered for the calling service in Azure AD. This value should have been noted at the time of registration. |
113
-
| resource |required | The App ID URI of the receiving service (secured resource). To find the App ID URI in the Azure Management Portal, select **Active Directory** and choose the directory. Select the application name, choose **All settings**, and then select **Properties**. |
113
+
| resource |required | The App ID URI of the receiving service (secured resource). To find the App ID URI in the Azure portal, select **Active Directory** and choose the directory. Select the application name, choose **All settings**, and then select **Properties**. |
114
114
| requested_token_use |required | Specifies how the request should be processed. In the On-Behalf-Of flow, the value must be **on_behalf_of**. |
115
115
| scope |required | A space separated list of scopes for the token request. For OpenID Connect, the scope **openid** must be specified.|
116
116
117
117
#### Example
118
118
119
-
The following HTTP POST requests an access token for the `https://graph.windows.net` web API. The `client_id` identifies the service that requests the access token.
119
+
The following HTTP POST requests an access token for the https://graph.windows.net web API. The `client_id` identifies the service that requests the access token.
120
120
121
121
```
122
122
// line breaks for legibility only
@@ -140,20 +140,20 @@ A service-to-service access token request with a certificate contains the follow
140
140
141
141
| Parameter || Description |
142
142
| --- | --- | --- |
143
-
| grant_type |required | The type of the token request. Since an OBO request uses a JSON Web Token (JWT), the value must be **urn:ietf:params:oauth:grant-type:jwt-bearer**. |
143
+
| grant_type |required | The type of the token request. Since an OBO request uses a JWT access token, the value must be **urn:ietf:params:oauth:grant-type:jwt-bearer**. |
144
144
| assertion |required | The value of the token used in the request. |
145
-
| client_id |required | The App ID assigned to the calling service during registration with Azure AD. To find the App ID in the Azure Management Portal, select **Active Directory**, choose the directory, and then select the application name. |
145
+
| client_id |required | The App ID assigned to the calling service during registration with Azure AD. To find the App ID in the Azure portal, select **Active Directory**, choose the directory, and then select the application name. |
146
146
| client_assertion_type |required |The value must be `urn:ietf:params:oauth:client-assertion-type:jwt-bearer`|
147
147
| client_assertion |required | A JSON Web Token that you create and sign with the certificate you registered as credentials for your application. See [certificate credentials](active-directory-certificate-credentials.md) to learn about assertion format and about how to register your certificate.|
148
-
| resource |required | The App ID URI of the receiving service (secured resource). To find the App ID URI in the Azure Management Portal, select **Active Directory** and choose the directory. Select the application name, choose **All settings**, and then select **Properties**. |
148
+
| resource |required | The App ID URI of the receiving service (secured resource). To find the App ID URI in the Azure portal, select **Active Directory** and choose the directory. Select the application name, choose **All settings**, and then select **Properties**. |
149
149
| requested_token_use |required | Specifies how the request should be processed. In the On-Behalf-Of flow, the value must be **on_behalf_of**. |
150
150
| scope |required | A space separated list of scopes for the token request. For OpenID Connect, the scope **openid** must be specified.|
151
151
152
-
Notice that the parameters are almost the same as in the case of the request by shared secret except that the `client_secret parameter` is replaced by two parameters: `client_assertion_type` and `client_assertion`.
152
+
These parameters are almost the same as with the request by shared secret except that the `client_secret parameter` is replaced by two parameters: `client_assertion_type` and `client_assertion`.
153
153
154
154
#### Example
155
155
156
-
The following HTTP POST requests an access token for the `https://graph.windows.net` web API with a certificate. The `client_id` identifies the service that requests the access token.
156
+
The following HTTP POST requests an access token for the https://graph.windows.net web API with a certificate. The `client_id` identifies the service that requests the access token.
157
157
158
158
```
159
159
// line breaks for legibility only
@@ -189,7 +189,7 @@ A success response is a JSON OAuth 2.0 response with the following parameters:
189
189
190
190
### Success response example
191
191
192
-
The following example shows a success response to a request for an access token for the `https://graph.windows.net` web API.
192
+
The following example shows a success response to a request for an access token for the https://graph.windows.net web API.
193
193
194
194
```
195
195
{
@@ -208,7 +208,7 @@ The following example shows a success response to a request for an access token
208
208
209
209
### Error response example
210
210
211
-
The Azure AD token endpoint returns an error response when trying to acquire an access token for the downstream API if the downstream API is set with a conditional access policy such as multi-factor authentication. The middle-tier service should surface this error to the client application so that the client application can provide the user interaction to satisfy the conditional access policy.
211
+
The Azure AD token endpoint returns an error response when it tries to acquire an access token for a downstream API that is set with a conditional access policy (e.g., multi-factor authentication). The middle-tier service should surface this error to the client application so that the client application can provide the user interaction to satisfy the conditional access policy.
## Service-to-service calls using a SAML assertion obtained with an OAuth2.0 On-Behalf-Of flow
237
+
## SAML assertions obtained with an OAuth2.0 OBO flow
238
238
239
239
Some OAuth-based web services need to access other web service APIs that accept SAML assertions in non-interactive flows. Azure Active Directory can provide a SAML assertion in response to an On-Behalf-Of flow that uses a SAML-based web service as a target resource.
240
240
@@ -246,24 +246,24 @@ Some OAuth-based web services need to access other web service APIs that accept
246
246
247
247
### Obtain a SAML token using an OBO request with a shared secret
248
248
249
-
A service-to-service request to obtain a SAML assertion contains the following parameters:
249
+
A service-to-service request for a SAML assertion contains the following parameters:
250
250
251
251
| Parameter || Description |
252
252
| --- | --- | --- |
253
253
| grant_type |required | The type of the token request. For a request using a JWT, the value must be **urn:ietf:params:oauth:grant-type:jwt-bearer**. |
254
254
| assertion |required | The value of the access token used in the request.|
255
-
| client_id |required | The App ID assigned to the calling service during registration with Azure AD. To find the App ID in the Azure Management Portal, select **Active Directory**, choose the directory, and then select the application name. |
255
+
| client_id |required | The App ID assigned to the calling service during registration with Azure AD. To find the App ID in the Azure portal, select **Active Directory**, choose the directory, and then select the application name. |
256
256
| client_secret |required | The key registered for the calling service in Azure AD. This value should have been noted at the time of registration. |
257
-
| resource |required | The App ID URI of the receiving service (secured resource). This is the resource that will be the Audience of the SAML token. The App ID URI of the receiving service (secured resource). To find the App ID URI in the Azure Management Portal, select **Active Directory** and choose the directory. Select the application name, choose **All settings**, and then select **Properties**. |
257
+
| resource |required | The App ID URI of the receiving service (secured resource). This is the resource that will be the Audience of the SAML token. To find the App ID URI in the Azure portal, select **Active Directory** and choose the directory. Select the application name, choose **All settings**, and then select **Properties**. |
258
258
| requested_token_use |required | Specifies how the request should be processed. In the On-Behalf-Of flow, the value must be **on_behalf_of**. |
259
-
| requested_token_type | required | Specifies the type of token requested. The value can be "urn:ietf:params:oauth:token-type:saml2" or "urn:ietf:params:oauth:token-type:saml1" depending on the requirements of the accessed resource. |
259
+
| requested_token_type | required | Specifies the type of token requested. The value can be **urn:ietf:params:oauth:token-type:saml2** or **urn:ietf:params:oauth:token-type:saml1** depending on the requirements of the accessed resource. |
260
260
261
261
The response contains a SAML token encoded in UTF8 and Base64url.
262
262
263
-
-**_SubjectConfirmationData_ for a SAML assertion sourced from an OBO call**: If the target application requires a recipient value in **SubjectConfirmationData**, then the value must be set as a non-wildcard Reply URL in the resource application configuration.
263
+
-**_SubjectConfirmationData_ for a SAML assertion sourced from an OBO call**: If the target application requires a recipient value in **SubjectConfirmationData**, then the value must be a non-wildcard Reply URL in the resource application configuration.
264
264
-**The _SubjectConfirmationData_ node**: The node can't contain an **InResponseTo** attribute since it's not part of a SAML response. The application receiving the SAML token must be able to accept the SAML assertion without an **InResponseTo** attribute.
265
265
266
-
-**Consent**: In order to receive a SAML token containing user data on an OAuth flow, consent must have been granted. For information on permissions and obtaining administrator consent, see [Permissions and consent in the Azure Active Directory v1.0 endpoint](https://docs.microsoft.com/azure/active-directory/develop/v1-permissions-and-consent).
266
+
-**Consent**: Consent must have been granted to receive a SAML token containing user data on an OAuth flow. For information on permissions and obtaining administrator consent, see [Permissions and consent in the Azure Active Directory v1.0 endpoint](https://docs.microsoft.com/azure/active-directory/develop/v1-permissions-and-consent).
0 commit comments