Skip to content

Commit 0e595f2

Browse files
authored
Merge pull request #218407 from MicrosoftGuyJFlo/UpdateDevConditionalAccess
[Azure AD] Developer - Conditional Access Update
2 parents f080815 + f53db05 commit 0e595f2

File tree

1 file changed

+69
-11
lines changed

1 file changed

+69
-11
lines changed

articles/active-directory/develop/developer-guide-conditional-access-authentication-context.md

Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,29 @@ services: active-directory
66
ms.service: active-directory
77
ms.subservice: develop
88
ms.topic: conceptual
9-
ms.date: 05/18/2021
9+
ms.date: 11/15/2022
1010

11-
ms.author: joflore
12-
author: MicrosoftGuyJFlo
11+
ms.author: kkrishna
12+
author: kalyankrishna1
1313
manager: CelesteDG
14-
ms.reviewer: kkrishna
14+
ms.reviewer: joflore
1515

1616
ms.workload: identity
1717

1818
ms.custom: aaddev
1919
---
20+
2021
# Developer guide to Conditional Access authentication context
2122

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.
2324

2425
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.
2526

2627
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.
2728

2829
## Problem statement
2930

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.
3132

3233
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?
3334

@@ -41,7 +42,7 @@ For example, while users may sign in to SharePoint using multi-factor authentica
4142

4243
**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).
4344

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.
4546

4647
## Integration steps
4748

@@ -71,7 +72,7 @@ Create or modify your Conditional Access policies to use the Conditional Access
7172

7273
1. Identity actions in the code that can be made available to map against auth context Ids.
7374
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.
7576

7677
These steps are the changes that you need to carry in your code base. The steps broadly comprise of
7778

@@ -93,7 +94,7 @@ These steps are the changes that you need to carry in your code base. The steps
9394

9495
- 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
9596
- 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).
9798

9899
```csharp
99100
public void CheckForRequiredAuthContext(string method)
@@ -207,15 +208,72 @@ These steps are the changes that you need to carry in your code base. The steps
207208

208209
## Caveats and recommendations
209210

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.
211212

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.
213214

214215
## Code samples
215216

216217
- [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)
217218
- [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)
218219

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+
219277
## Next steps
220278

221279
- [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

Comments
 (0)