Share via


AuthorizationPolicyBuilder Class

Definition

Used for building policies.

public ref class AuthorizationPolicyBuilder
public class AuthorizationPolicyBuilder
type AuthorizationPolicyBuilder = class
Public Class AuthorizationPolicyBuilder
Inheritance
AuthorizationPolicyBuilder

Constructors

AuthorizationPolicyBuilder(AuthorizationPolicy)

Creates a new instance of AuthorizationPolicyBuilder.

AuthorizationPolicyBuilder(String[])

Creates a new instance of AuthorizationPolicyBuilder

Properties

AuthenticationSchemes

Gets or sets a list authentication schemes the Requirements are evaluated against.

When not specified, the requirements are evaluated against default schemes.

Requirements

Gets or sets a list of IAuthorizationRequirements which must succeed for this policy to be successful.

Methods

AddAuthenticationSchemes(String[])

Adds the specified authentication schemes to the AuthenticationSchemes for this instance.

AddRequirements(IAuthorizationRequirement[])

Adds the specified requirements to the Requirements for this instance.

Build()

Builds a new AuthorizationPolicy from the requirements in this instance.

Combine(AuthorizationPolicy)

Combines the specified policy into the current instance.

RequireAssertion(Func<AuthorizationHandlerContext,Boolean>)

Adds an AssertionRequirement to the current instance.

RequireAssertion(Func<AuthorizationHandlerContext,Task<Boolean>>)

Adds an AssertionRequirement to the current instance.

RequireAuthenticatedUser()

Adds DenyAnonymousAuthorizationRequirement to the current instance which enforces that the current user is authenticated.

RequireClaim(String, IEnumerable<String>)

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

RequireClaim(String, String[])

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

RequireClaim(String)

Adds a ClaimsAuthorizationRequirement to the current instance which requires that the current user has the specified claim.

RequireRole(IEnumerable<String>)

Adds a RolesAuthorizationRequirement to the current instance which enforces that the current user must have at least one of the specified roles.

RequireRole(String[])

Adds a RolesAuthorizationRequirement to the current instance which enforces that the current user must have at least one of the specified roles.

RequireUserName(String)

Adds a NameAuthorizationRequirement to the current instance which enforces that the current user matches the specified name.

Applies to