Table of Contents

Class MicrosoftIdentityConsentAndConditionalAccessHandler

Namespace
Microsoft.Identity.Web
Assembly
Microsoft.Identity.Web.dll

Handler for Blazor specific APIs to handle incremental consent and conditional access.

public class MicrosoftIdentityConsentAndConditionalAccessHandler
Inheritance
MicrosoftIdentityConsentAndConditionalAccessHandler
Inherited Members

Constructors

MicrosoftIdentityConsentAndConditionalAccessHandler(IServiceProvider)

Initializes a new instance of the MicrosoftIdentityConsentAndConditionalAccessHandler class.

public MicrosoftIdentityConsentAndConditionalAccessHandler(IServiceProvider serviceProvider)

Parameters

serviceProvider IServiceProvider

Service provider to get the HttpContextAccessor for the current HttpContext, when available.

Properties

BaseUri

Base URI to use in forming the redirect.

public string? BaseUri { get; set; }

Property Value

string

IsBlazorServer

Boolean to determine if server is Blazor.

public bool IsBlazorServer { get; set; }

Property Value

bool

User

Current user.

public ClaimsPrincipal User { get; set; }

Property Value

ClaimsPrincipal

Methods

ChallengeUser(string[]?, string?, string?)

Forces the user to consent to specific scopes and perform Conditional Access to get specific claims. Use on a Razor/Blazor page or controller to proactively ensure the scopes and/or claims before acquiring a token. The other mechanism HandleException(Exception) ensures claims and scopes requested by Azure AD after a failed token acquisition attempt. See https://aka.ms/ms-id-web/ca_incremental-consent for details.

public void ChallengeUser(string[]? scopes, string? claims = null, string? userflow = null)

Parameters

scopes string[]

Scopes to request.

claims string

Claims to ensure.

userflow string

Userflow being invoked for AAD B2C.

HandleException(Exception)

For Blazor/Razor pages to process the exception from a user challenge.

public void HandleException(Exception exception)

Parameters

exception Exception

Exception.