Class MockAuthGate

Namespace
Kuestenlogik.Bowire.Mock
Assembly
Kuestenlogik.Bowire.Mock.dll

#562: the mock's optional auth gate. Holds a mutable auth-requirement — the whole reference is swapped to toggle auth live (mirroring the Faults hot-swap) so the gate always reads a consistent snapshot — and evaluates each request: when auth is required, a request that presents no credential (or the wrong one) is rejected with 401 before replay.

public sealed class MockAuthGate
Inheritance
MockAuthGate
Inherited Members

Constructors

MockAuthGate()

public MockAuthGate()

Properties

Current

The active requirement, or null when auth isn't required. Assign the whole reference to change it live — a partial field mutation would let a request see an inconsistent requirement.

public MockAuthRequirement? Current { get; set; }

Property Value

MockAuthRequirement

Methods

IsAuthorized(HttpContext)

True when the request is authorized (or auth isn't required).

public bool IsAuthorized(HttpContext ctx)

Parameters

ctx HttpContext

Returns

bool

RequireBearer(string?)

#562: the mapping behind bowire mock --require-auth <token> — an empty/absent token yields an open gate, otherwise one requiring a bearer token equal to credential. The single canonical place the flag becomes a requirement, so the wiring is guarded by one test.

public static MockAuthGate RequireBearer(string? credential)

Parameters

credential string

Returns

MockAuthGate