Class ScopedBowireUserStore

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

The identity-scoped IBowireUserStore — one authenticated subject, one directory under <storage root>/users/ (#97).

public sealed class ScopedBowireUserStore : IBowireUserStore, IBowireStorageRootProvider
Inheritance
ScopedBowireUserStore
Implements
Inherited Members

Remarks

Phase B shipped the seam and a default that keeps the flat single-user layout, and said a multi-tenant deployment would "swap in an implementation that scopes paths by the authenticated user's sub claim". This is that implementation. Until it existed there was nothing to swap in, and nothing for a migration to migrate into — which is why it lands with Phase E rather than after it.

It is deliberately not aware of requests, authentication or middleware. It answers one question — where does this subject's state live — and BowireTenancy answers the separate question of whose turn it is. Keeping those apart is what lets the migration construct a store for a subject that is not the caller, which is the whole of what a migration does.

Constructors

ScopedBowireUserStore(string, string)

A store for subject under storageRoot.

public ScopedBowireUserStore(string storageRoot, string subject)

Parameters

storageRoot string

The Data root — the same directory the flat single-user layout uses. The slot goes under users/ inside it rather than beside it, so a project that opted its storage into .bowire/ keeps its identities there too.

subject string

The authenticated subject, verbatim from the token.

Properties

Slot

Absolute path to this subject's slot.

public string Slot { get; }

Property Value

string

Slug

The directory name Subject maps to.

public string Slug { get; }

Property Value

string

StorageRoot

The storage root this store resolves under — the directory the Data scope means, not the per-identity slot inside it.

public string StorageRoot { get; }

Property Value

string

Subject

The authenticated subject this store belongs to.

public string Subject { get; }

Property Value

string

Methods

GetUserPath(string)

Absolute path to the file filename under the active user's scope. Implementations are free to colocate users (single shared dir, the default) or partition by identity (per-user subdirectory, the multi-tenant case).

public string GetUserPath(string filename)

Parameters

filename string

Trailing-component file name without any directory prefix -- e.g. "environments.json", "recordings.json". Implementations decorate it with whatever path makes sense for their model.

Returns

string