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
Methods
FromConfiguration(MockConfiguration?, IAuthRecordingResolver?, string?)
#1103: the gate a mock configuration's auth block asks for, as a
CLI or MCP start applies it. An authRecordingId is resolved
through resolver first; a reference that does not
resolve throws InvalidOperationException rather than
arming a weaker gate. An open gate when the configuration requires none.
public static MockAuthGate FromConfiguration(MockConfiguration? config, IAuthRecordingResolver? resolver, string? workspaceId)
Parameters
configMockConfigurationresolverIAuthRecordingResolverworkspaceIdstring
Returns
IsAuthorized(HttpContext)
True when the request is authorized (or auth isn't required).
public bool IsAuthorized(HttpContext ctx)
Parameters
ctxHttpContext
Returns
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
credentialstring