Class BowireAuthServiceCollectionExtensions

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

Wires the Bowire auth seam into the host's IServiceCollection. Pairs with the .RequireAuthorization(BowireAuthPolicies.Default) calls inside BowireApiEndpoints.Map.

public static class BowireAuthServiceCollectionExtensions
Inheritance
BowireAuthServiceCollectionExtensions
Inherited Members

Methods

AddBowireAuth(IServiceCollection, IConfiguration, Action<BowireAuthOptions>?)

Register Bowire's auth seam. Reads Bowire:Auth from configuration for the active provider id; optional configure wins over the config file. When no provider is selected, registers a null-valued IBowireAuthProvider sentinel so BowireApiEndpoints.Map can branch without throwing.

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

Parameters

services IServiceCollection
configuration IConfiguration
configure Action<BowireAuthOptions>

Returns

IServiceCollection

UseBowireAuth(IApplicationBuilder)

Invoke the active IBowireAuthProvider's Configure(IApplicationBuilder) hook so the provider can insert middleware into the host pipeline. Wire between app.UseAuthentication() and app.MapBowire() in the host's startup. No-op when no provider is registered, so calling it unconditionally is safe and the standard pattern.

public static IApplicationBuilder UseBowireAuth(this IApplicationBuilder app)

Parameters

app IApplicationBuilder

Returns

IApplicationBuilder

Remarks

Most providers don't need this hook -- OIDC, SAML, and API-key schemes all set themselves up through pure DI registration in AddAuthentication(IServiceCollection, IConfiguration) and ride ASP.NET's stock UseAuthentication pipeline. Override Configure(IApplicationBuilder) only when the provider's scheme can't be expressed as pure DI (e.g. it owns a callback URL outside the Bowire endpoint group).