Table of Contents

Class RequiredScopeOrAppPermissionExtensions

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

Extensions for building the required scope or app permission attribute during application startup.

public static class RequiredScopeOrAppPermissionExtensions
Inheritance
RequiredScopeOrAppPermissionExtensions
Inherited Members

Methods

AddRequiredScopeOrAppPermissionAuthorization(IServiceCollection)

This method adds support for the required scope or app permission attribute. It adds a default policy that adds a scope requirement or app permission requirement. This requirement looks for IAuthRequiredScopeOrAppPermissionMetadata on the current endpoint.

public static IServiceCollection AddRequiredScopeOrAppPermissionAuthorization(this IServiceCollection services)

Parameters

services IServiceCollection

The services being configured.

Returns

IServiceCollection

Services.

RequireScopeOrAppPermission<TBuilder>(TBuilder, string[], string[])

This method adds metadata to route endpoint to describe required scopes or app permissions. It's the imperative version of the [RequiredScopeOrAppPermission] attribute.

public static TBuilder RequireScopeOrAppPermission<TBuilder>(this TBuilder endpointConventionBuilder, string[] scope, string[] appPermission) where TBuilder : IEndpointConventionBuilder

Parameters

endpointConventionBuilder TBuilder

To customize the endpoints.

scope string[]

Scope.

appPermission string[]

App permission.

Returns

TBuilder

Builder.

Type Parameters

TBuilder

Class implementing IEndpointConventionBuilder.