Skip to content

Authorization Service

Ioan Crisan edited this page Oct 16, 2018 · 3 revisions

Aim and usage

The authorization service is used to ensure that a certain context has the required authorization.

IAuthorizationService

This is a shared application service contract providing a single method:

  • AuthorizeAsync(authContext: IAuthorizationContext, cancellationToken: CancellationToken = default): Task<bool>

IAuthorizationContext

An authorization context contains:

  • Identity (inherited from the base IContext): the identity requesting authorization.
  • RequiredPermissions/RequiredPermissionTypes: the list of permissions to check.
  • Scope (optional): a scope object for which the required permissions apply.
  • ThrowOnFailure (default true): A boolean value indicating whether to throw on authorization failure. If false is indicated, the authorization check will return false upon failure, otherwise an exception will occur.

Clone this wiki locally