Table of Contents

Class AuthorizeForScopesAttribute

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

Filter used on a controller action to trigger incremental consent.

public class AuthorizeForScopesAttribute : ExceptionFilterAttribute, IAsyncExceptionFilter, IExceptionFilter, IOrderedFilter, IFilterMetadata
Inheritance
AuthorizeForScopesAttribute
Implements
Inherited Members

Examples

The following controller action will trigger.

[AuthorizeForScopes(Scopes = new[] {"Mail.Send"})]
public async Task<IActionResult> SendEmail()
{
}

Constructors

AuthorizeForScopesAttribute()

public AuthorizeForScopesAttribute()

Properties

AuthenticationScheme

Allows specifying an AuthenticationScheme if OpenIdConnect is not the default challenge scheme.

public string? AuthenticationScheme { get; set; }

Property Value

string

ScopeKeySection

Key section on the configuration file that holds the scope value.

public string? ScopeKeySection { get; set; }

Property Value

string

Scopes

Scopes to request.

public string[]? Scopes { get; set; }

Property Value

string[]

UserFlow

Azure AD B2C user flow.

public string? UserFlow { get; set; }

Property Value

string

Methods

OnException(ExceptionContext)

Handles the Microsoft.Identity.Client.MsalUiRequiredException.

public override void OnException(ExceptionContext context)

Parameters

context ExceptionContext

Context provided by ASP.NET Core.