Class BowireTenancyExtensions

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

Wires per-identity storage into a host (#97).

public static class BowireTenancyExtensions
Inheritance
BowireTenancyExtensions
Inherited Members

Methods

AddBowireTenancy(IServiceCollection, IConfiguration, Action<BowireTenancyOptions>?)

Register the tenancy seam. Reads Bowire:MultiTenant; configure wins over the configuration file.

public static IServiceCollection AddBowireTenancy(this IServiceCollection services, IConfiguration configuration, Action<BowireTenancyOptions>? configure = null)

Parameters

services IServiceCollection
configuration IConfiguration
configure Action<BowireTenancyOptions>

Returns

IServiceCollection

Remarks

Registering is not enabling. The services land either way so that a migration endpoint can be mapped unconditionally, and UseBowireTenancy(IApplicationBuilder) is where the store actually changes.

UseBowireTenancy(IApplicationBuilder)

Serve each authenticated identity out of its own slot, and put the scope in place for the duration of the request.

public static IApplicationBuilder UseBowireTenancy(this IApplicationBuilder app)

Parameters

app IApplicationBuilder

Returns

IApplicationBuilder

Remarks

No-op unless Enabled is set, so calling it unconditionally is safe and is the intended pattern — alongside UseBowireAuth, after UseAuthentication, since there is no identity to scope by before that has run.

Swapping Current here rather than in AddBowireTenancy(IServiceCollection, IConfiguration, Action<BowireTenancyOptions>?) is deliberate: the storage root can still move between the two — a project manifest opting into .bowire/ is applied when the host is built — and a tenancy that captured the root before that would file everyone under the wrong tree.