Class BowireAuditLog

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

One line per action taken on somebody else's behalf (#98).

public sealed class BowireAuditLog
Inheritance
BowireAuditLog
Inherited Members

Remarks

Impersonation is the one place in Bowire where the person doing something and the person it happens to are different people. Everything else in the product can be reconstructed from its own state; this cannot — once an administrator has acted as somebody, the resulting recording looks exactly like one that person made themselves.

So the log is append-only and names both identities on every line. It is not a general request log: writing every read would bury the handful of lines that matter under a day of noise, and a log nobody can read is not an audit trail. Only the start, the end, and the requests that changed something are recorded.

Constructors

BowireAuditLog(string, TimeProvider?)

A log under storageRoot.

public BowireAuditLog(string storageRoot, TimeProvider? clock = null)

Parameters

storageRoot string

The data root.

clock TimeProvider

Injected in tests so timestamps are predictable.

Fields

DirectoryName

The directory under the storage root that holds the log.

public const string DirectoryName = "audit"

Field Value

string

Properties

Directory

Where the log is kept.

public string Directory { get; }

Property Value

string

File

The log itself.

public string File { get; }

Property Value

string

Methods

Lines()

Every line in the log, oldest first. For tests and operators.

public IReadOnlyList<string> Lines()

Returns

IReadOnlyList<string>

Record(string, string, string, string?)

Record one action.

public void Record(string action, string actor, string actingAs, string? detail = null)

Parameters

action string

What happened — begin, end, or the HTTP method.

actor string

Who did it. The real caller, never the impersonated identity.

actingAs string

Whose behalf it was on.

detail string

The path, or whatever else identifies the action.