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
Copy file name to clipboardExpand all lines: articles/active-directory/develop/developer-guide-conditional-access-authentication-context.md
+69-11Lines changed: 69 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,28 +6,29 @@ services: active-directory
6
6
ms.service: active-directory
7
7
ms.subservice: develop
8
8
ms.topic: conceptual
9
-
ms.date: 05/18/2021
9
+
ms.date: 11/15/2022
10
10
11
-
ms.author: joflore
12
-
author: MicrosoftGuyJFlo
11
+
ms.author: kkrishna
12
+
author: kalyankrishna1
13
13
manager: CelesteDG
14
-
ms.reviewer: kkrishna
14
+
ms.reviewer: joflore
15
15
16
16
ms.workload: identity
17
17
18
18
ms.custom: aaddev
19
19
---
20
+
20
21
# Developer guide to Conditional Access authentication context
21
22
22
-
[Conditional Access](../conditional-access/overview.md) is the Zero Trust control plane that allows you to target policies for access to all your apps – old or new, private, or public, on-premises, or multi-cloud. With [Conditional Access authentication context](../conditional-access/concept-conditional-access-cloud-apps.md#authentication-context), you can apply different policies within those apps.
23
+
[Conditional Access](../conditional-access/overview.md) is the Zero Trust control plane that allows you to target policies for access to all your apps – old or new, private, or public, on-premises, or multicloud. With [Conditional Access authentication context](../conditional-access/concept-conditional-access-cloud-apps.md#authentication-context), you can apply different policies within those apps.
23
24
24
25
Conditional Access authentication context (auth context) allows you to apply granular policies to sensitive data and actions instead of just at the app level. You can refine your Zero Trust policies for least privileged access while minimizing user friction and keeping users more productive and your resources more secure. Today, it can be used by applications using [OpenId Connect](https://openid.net/specs/openid-connect-core-1_0.html) for authentication developed by your company to protect sensitive resources, like high-value transactions or viewing employee personal data.
25
26
26
27
Use the Azure AD Conditional Access engine's new auth context feature to trigger a demand for step-up authentication from within your application and services. Developers now have the power to demand enhanced stronger authentication, selectively, like MFA from their end users from within their applications. This feature helps developers build smoother user experiences for most parts of their application, while access to more secure operations and data remains behind stronger authentication controls.
27
28
28
29
## Problem statement
29
30
30
-
The IT administrators and regulators often struggle between balancing prompting their users with additional factors of authentication too frequently and achieving adequate security and policy adherence for applications and services where parts of them contain sensitive data and operations. It can be a choice between a strong policy that impacts users' productivity when they access most data and actions or a policy that is not strong enough for sensitive resources.
31
+
The IT administrators and regulators often struggle between balancing prompting their users with additional factors of authentication too frequently and achieving adequate security and policy adherence for applications and services where parts of them contain sensitive data and operations. It can be a choice between a strong policy that impacts users' productivity when they access most data and actions or a policy that isn't strong enough for sensitive resources.
31
32
32
33
So, what if apps were able to mix both, where they can function with a relatively lesser security and less frequent prompts for most users and operations and yet conditionally stepping up the security requirement when the users accessed more sensitive parts?
33
34
@@ -41,7 +42,7 @@ For example, while users may sign in to SharePoint using multi-factor authentica
41
42
42
43
**Second**, [Conditional Access](../conditional-access/overview.md) requires Azure AD Premium P1 licensing. More information about licensing can be found on the [Azure AD pricing page](https://www.microsoft.com/security/business/identity-access-management/azure-ad-pricing).
43
44
44
-
**Third**, today it is only available to applications that sign-in users. Applications that authenticate as themselves are not supported. Use the [Authentication flows and application scenarios guide](authentication-flows-app-scenarios.md) to learn about the supported authentication app types and flows in the Microsoft Identity Platform.
45
+
**Third**, today it's only available to applications that sign-in users. Applications that authenticate as themselves aren't supported. Use the [Authentication flows and application scenarios guide](authentication-flows-app-scenarios.md) to learn about the supported authentication app types and flows in the Microsoft Identity Platform.
45
46
46
47
## Integration steps
47
48
@@ -71,7 +72,7 @@ Create or modify your Conditional Access policies to use the Conditional Access
71
72
72
73
1. Identity actions in the code that can be made available to map against auth context Ids.
73
74
1. Build a screen in the admin portal of the app (or an equivalent functionality) that IT admins can use to map sensitive actions against an available auth context ID.
74
-
1. See the code sample, [Use the Conditional Access Auth Context to perform step-up authentication](https://github.com/Azure-Samples/ms-identity-ca-auth-context/blob/main/README.md) for an example on how it is done.
75
+
1. See the code sample, [Use the Conditional Access Auth Context to perform step-up authentication](https://github.com/Azure-Samples/ms-identity-ca-auth-context/blob/main/README.md) for an example on how it's done.
75
76
76
77
These steps are the changes that you need to carry in your code base. The steps broadly comprise of
77
78
@@ -93,7 +94,7 @@ These steps are the changes that you need to carry in your code base. The steps
93
94
94
95
- Checks if the application's action being called requires step-up authentication. It does so by checking its database for a saved mapping for this method
95
96
- If this action indeed requires an elevated auth context, it checks the **acrs** claim for an existing, matching Auth Context ID.
96
-
- If a matching Auth Context ID is not found, it raises a [claims challenge](claims-challenge.md#claims-challenge-header-format).
97
+
- If a matching Auth Context ID isn't found, it raises a [claims challenge](claims-challenge.md#claims-challenge-header-format).
@@ -207,15 +208,72 @@ These steps are the changes that you need to carry in your code base. The steps
207
208
208
209
## Caveats and recommendations
209
210
210
-
Do not hard-code Auth Context values in your app. Apps should read and apply auth context [using MS Graph calls](/graph/api/resources/authenticationcontextclassreference). This practice is critical for [multi-tenant applications](howto-convert-app-to-be-multi-tenant.md). The Auth Context values will vary between Azure AD tenants will not available in Azure AD free edition. For more information on how an app should query, set, and use auth context in their code, see the code sample, [Use the Conditional Access auth context to perform step-up authentication](https://github.com/Azure-Samples/ms-identity-ca-auth-context/blob/main/README.md) as how an app should query, set and use auth context in their code.
211
+
Don't hard-code Auth Context values in your app. Apps should read and apply auth context [using MS Graph calls](/graph/api/resources/authenticationcontextclassreference). This practice is critical for [multi-tenant applications](howto-convert-app-to-be-multi-tenant.md). The Auth Context values will vary between Azure AD tenants and won't be available in Azure AD free edition. For more information on how an app should query, set, and use auth context in their code, see the code sample, [Use the Conditional Access auth context to perform step-up authentication](https://github.com/Azure-Samples/ms-identity-ca-auth-context/blob/main/README.md) as how an app should query, set and use auth context in their code.
211
212
212
-
Do not use auth context where the app itself is going to be a target of Conditional Access policies. The feature works best when parts of the application require the user to meet a higher bar of authentication.
213
+
Don't use auth context where the app itself is going to be a target of Conditional Access policies. The feature works best when parts of the application require the user to meet a higher bar of authentication.
213
214
214
215
## Code samples
215
216
216
217
-[Use the Conditional Access auth context to perform step-up authentication for high-privilege operations in a web app](https://github.com/Azure-Samples/ms-identity-dotnetcore-ca-auth-context-app/blob/main/README.md)
217
218
-[Use the Conditional Access auth context to perform step-up authentication for high-privilege operations in a web API](https://github.com/Azure-Samples/ms-identity-ca-auth-context/blob/main/README.md)
218
219
220
+
## Authentication context [ACRs] in Conditional Access expected behavior
221
+
222
+
## Explicit auth context satisfaction in requests
223
+
224
+
A client can explicitly ask for a token with an Auth Context (ACRS) through the claims in the request's body. If an ACRS was requested, Conditional Access will allow issuing the token with the requested ACRS if all challenges were completed.
225
+
226
+
## Expected behavior when an auth context isn't protected by Conditional Access in the tenant
227
+
228
+
Conditional Access may issue an ACRS in a token's claims when all Conditional Access policy assigned to the ACRS value has been satisfied. If no Conditional Access policy is assigned to an ACRS value the claim may still be issued, because all policy requirements have been satisfied.
229
+
230
+
## Summary table for expected behavior when ACRS are explicitly requested
231
+
232
+
ACRS requested | Policy applied | Control satisfied | ACRS added to claims |
233
+
|--|--|--|--|--|
234
+
|Yes | No | Yes | Yes |
235
+
|Yes | Yes | No | No |
236
+
|Yes | Yes | Yes | Yes |
237
+
|Yes | No policies configured with ACRS | Yes | Yes |
238
+
239
+
## Implicit auth context satisfaction by opportunistic evaluation
240
+
241
+
A resource provider may opt in to the optional 'acrs' claim. Conditional Access will try to add ACRS to the token claims opportunistically in order to avoid round trips to acquire new tokens to Azure AD. In that evaluation, Conditional Access will check if the policies protecting Auth Context challenges are already satisfied and will add the ACRS to the token claims if so.
242
+
243
+
> [!NOTE]
244
+
> Each token type will need to be individually opted-in (ID token, Access token).
245
+
>
246
+
> If a resource provider doesn't opt in to the optional 'acrs' claim, the only way to get an ACRS in the token will be to explicitly ask for it in a token request. It will not get the benefits of the opportunistic evaluation, therefore every time that the required ACRS will be missing from the token claims, the resource provider will challenge the client to acquire a new token containing it in the claims.
247
+
248
+
## Expected behavior with auth context and session controls for implicit ACRS opportunistic evaluation
249
+
250
+
### Sign-in frequency by interval
251
+
252
+
Conditional Access will consider "sign-in frequency by interval" as satisfied for opportunistic ACRS evaluation when all the present authentication factors auth instants are within the sign-in frequency interval. In case that the first factor auth instant is stale, or if the second factor (MFA) is present and its auth instant is stale, the sign-in frequency by interval won't be satisfied and the ACRS won't be issued in the token opportunistically.
253
+
254
+
### Cloud App Security (CAS)
255
+
256
+
Conditional Access will consider CAS session control as satisfied for opportunistic ACRS evaluation, when a CAS session was established during that request. For example, when a request comes in and any Conditional Access policy applied and enforced a CAS session, and in addition there's a Conditional Access policy that also requires a CAS session, since the CAS session will be enforced, that will satisfy the CAS session control for the opportunistic evaluation.
257
+
258
+
## Expected behavior when a tenant contain Conditional Access policies protecting auth context
259
+
260
+
The table below will show all corner cases where ACRS is added to the token's claims by opportunistic evaluation.
261
+
262
+
**Policy A**: Require MFA from all users, excluding the user "Ariel", when asking for "c1" acrs.
263
+
**Policy B**: Block all users, excluding user "Jay", when asking for "c2", or "c3" acrs.
264
+
265
+
| Flow | ACRS requested | Policy applied | Control satisfied | ACRS added to claims |
266
+
|--|--|--|--|--|
267
+
| Ariel requests for an access token | "c1" | None | Yes for "c1". No for "c2" and "c3" | "c1" (requested) |
268
+
| Ariel requests for an access token | "c2" | Policy B | Blocked by policy B | None |
269
+
| Ariel requests for an access token | None | None | Yes for "c1". No for "c2" and "c3" | "c1" (opportunistically added from policy A) |
270
+
| Jay requests for an access token (without MFA) | "c1" | Policy A | No | None |
271
+
| Jay requests for an access token (with MFA) | "c1" | Policy A | Yes | "c1" (requested), "c2" (opportunistically added from policy B), "c3" (opportunistically added from policy B)|
272
+
| Jay requests for an access token (without MFA) | "c2" | None | Yes for "c2" and "c3". No for "c1" | "c2" (requested), "c3" (opportunistically added from policy B) |
273
+
| Jay requests for an access token (with MFA) | "c2" | None | Yes for "c1", "c2" and "c3" | "c1" (best effort from A), "c2" (requested), "c3" (opportunistically added from policy B) |
274
+
| Jay requests for an access token (with MFA) | None | None | Yes for "c1", "c2" and "c3" | "c1", "c2", "c3" all opportunistically added |
275
+
| Jay requests for an access token (without MFA) | None | None | Yes for "c2" and "c3". No for "c1"| "c2", "c3" all opportunistically added |
276
+
219
277
## Next steps
220
278
221
279
-[Granular Conditional Access for sensitive data and actions (Blog)](https://techcommunity.microsoft.com/t5/azure-active-directory-identity/granular-conditional-access-for-sensitive-data-and-actions/ba-p/1751775)
0 commit comments