Class BowireAdminGate

Namespace
Kuestenlogik.Bowire.Auth
Assembly
Kuestenlogik.Bowire.dll

The one answer to "may this caller administer the install" (#636).

public static class BowireAdminGate
Inheritance
BowireAdminGate
Inherited Members

Remarks

Some of what the workbench can do is not a preference but a change to the install itself — installing a plugin, above all, which downloads a package and puts assemblies where the next start loads them into the server process. On a laptop the person at the keyboard owns the machine and there is nothing to gate. On a shared install the least-privileged identity must not be able to reach code execution as the server.

The authority is IBowireUserDirectory's, the same source impersonation reads, so "administrator" has one definition rather than one per endpoint.

Methods

IsAdministrator(HttpContext)

Whether the caller may administer the install, for a reader that wants the fact rather than a refusal — the identity endpoint, so the workbench can leave out a control instead of offering one that will be refused.

public static bool IsAdministrator(HttpContext http)

Parameters

http HttpContext

Returns

bool

RequireAdministrator(HttpContext, string)

null when the caller may administer the install, a refusal otherwise.

public static IResult? RequireAdministrator(HttpContext http, string action)

Parameters

http HttpContext

The request being served.

action string

What was being attempted, in the sentence "Only an administrator can …". Reaches the operator, so write it as prose.

Returns

IResult

Remarks

Ungated without an auth provider. That is the laptop and the embedded host that never configured identities: there is one person, gating them protects nobody, and it would break the ordinary case to answer a threat model that does not exist there. The condition is the same one RequireBowireAuth uses, so "this install has identities" is decided in one way.

The real caller decides, not the impersonated one. While an administrator is looking at somebody else's workbench, the tenancy scope names the target; reading it here would strip an administrator of the authority they are exercising — including the authority to stop. A non-administrator cannot impersonate at all, so reading the actor never grants anything.