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
policyNamestringThe name of the policy
exceptionMessagestringThe 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
policyNamestringThe name of the policy