Partilhar via


PolicyBuilderExtensions.RequireScopeOrAppPermission Method

Definition

Adds a ScopeOrAppPermissionAuthorizationRequirement to the current instance which requires that the current user has the specified claim and that the claim value must be one of the allowed values.

public static Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder RequireScopeOrAppPermission (this Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder authorizationPolicyBuilder, System.Collections.Generic.IEnumerable<string> allowedScopeValues, System.Collections.Generic.IEnumerable<string> allowedAppPermissionValues);
static member RequireScopeOrAppPermission : Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder * seq<string> * seq<string> -> Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder
<Extension()>
Public Function RequireScopeOrAppPermission (authorizationPolicyBuilder As AuthorizationPolicyBuilder, allowedScopeValues As IEnumerable(Of String), allowedAppPermissionValues As IEnumerable(Of String)) As AuthorizationPolicyBuilder

Parameters

authorizationPolicyBuilder
AuthorizationPolicyBuilder

Used for building policies during application startup.

allowedScopeValues
IEnumerable<String>

scopes (the value of scope or scp) accepted by this app.

allowedAppPermissionValues
IEnumerable<String>

App permission (in role claim) that this app accepts.

Returns

A reference to this instance after the operation has completed.

Applies to