Table of Contents

Interface IApplicationAuthorizationPolicy

Namespace
Arc4u.Authorization
Assembly
Arc4u.Authorization.dll

Checks, from code, that the current user satisfies an authorization policy.

public interface IApplicationAuthorizationPolicy

Methods

AuthorizeAsync(string, string?)

Check if the user is authorized to access the resource based on the policy name.

Task AuthorizeAsync(string policyName, string? exceptionMessage = null)

Parameters

policyName string

The name of the policy

exceptionMessage string

The message of the exception thrown when the user is not authorized. When empty, a default message giving the policy name is used.

Returns

Task

A task that completes when the user is authorized.

Exceptions

UnauthorizedAccessException

If the user is not authorized.

IsAuthorizeAsync(string)

Check if the user is authorized to access the resource based on the policy name.

Task<bool> IsAuthorizeAsync(string policyName)

Parameters

policyName string

The name of the policy

Returns

Task<bool>

true if there is a current principal that satisfies the policy, otherwise false.