Compartir a través de


PolicyBuilderExtensions Class

Definition

Extensions for building the RequiredScope policy during application startup.

public static class PolicyBuilderExtensions
type PolicyBuilderExtensions = class
Public Module PolicyBuilderExtensions
Inheritance
PolicyBuilderExtensions

Examples

services.AddAuthorization(o =>
{ o.AddPolicy("Custom",
    policyBuilder =>policyBuilder.RequireScope("access_as_user"));
});

Methods

RequireScope(AuthorizationPolicyBuilder, IEnumerable<String>)

Adds a ScopeAuthorizationRequirement 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.

RequireScope(AuthorizationPolicyBuilder, String[])

Adds a ScopeAuthorizationRequirement 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.

RequireScopeOrAppPermission(AuthorizationPolicyBuilder, IEnumerable<String>, IEnumerable<String>)

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.

Applies to