Table of Contents

Class AccessAuthorization

Namespace
MailFathom.Application.Access
Assembly
MailFathom.Application.dll

What a use case asks before it does the work it was reached for.

public sealed class AccessAuthorization
Inheritance
AccessAuthorization
Inherited Members

Remarks

The transport refuses what it can refuse cheaply, and this is the authority. An entrypoint added later — a rule action, a worker, a command, a second protocol — reaches a use case without passing any middleware, so a check that lived only there is one the new entrypoint forgets. Asking here is what makes the answer a property of the operation instead of a property of the route somebody happened to arrive by.

Each method admits exactly one kind of principal and refuses every other, including a principal that holds more. RequireProcessIdentity() in particular is not "a caller with everything granted": a principal that could be admitted by holding a permission would be reachable by whoever an operator granted that permission to, which is the opposite of what work no caller requested runs under.

Every method refuses when the work was reached under no principal, so an entrypoint that never stated what admitted it fails rather than defaulting to permitted.

Permits(MailFathomPermission) is the one member that reports instead of refusing, for a boundary composing an answer per caller rather than performing an operation for one. It decides nothing of its own: it answers exactly what RequirePermission(MailFathomPermission) would have refused, so the transport and the use case cannot come to disagree about what holding a permission means.

Constructors

AccessAuthorization(IAuthorizedPrincipalSource)

Initializes the authorization over the principal of the unit of work in hand.

Properties

PrincipalIdentity

Gets what the work in hand was admitted as, or null where it was reached under no principal.

Methods

Permits(MailFathomPermission)

Answers the same question RequirePermission(MailFathomPermission) asks, for a boundary that has to decide rather than refuse.

RequireAnyPermission(MailFathomPermission, MailFathomPermission)

Requires that an admitted caller holding either of two named capabilities is what reached this use case.

RequirePermission(MailFathomPermission)

Requires that an admitted caller holding one named capability is what reached this use case.

RequireProcessIdentity()

Requires that this use case was reached as work no caller requested.

RequireSignedCapability()

Requires that a capability this deployment signed is what reached this use case.