Watir.DotNetCore.HttpPipelineExtensions
1.0.2
dotnet add package Watir.DotNetCore.HttpPipelineExtensions --version 1.0.2
NuGet\Install-Package Watir.DotNetCore.HttpPipelineExtensions -Version 1.0.2
<PackageReference Include="Watir.DotNetCore.HttpPipelineExtensions" Version="1.0.2" />
<PackageVersion Include="Watir.DotNetCore.HttpPipelineExtensions" Version="1.0.2" />
<PackageReference Include="Watir.DotNetCore.HttpPipelineExtensions" />
paket add Watir.DotNetCore.HttpPipelineExtensions --version 1.0.2
#r "nuget: Watir.DotNetCore.HttpPipelineExtensions, 1.0.2"
#:package Watir.DotNetCore.HttpPipelineExtensions@1.0.2
#addin nuget:?package=Watir.DotNetCore.HttpPipelineExtensions&version=1.0.2
#tool nuget:?package=Watir.DotNetCore.HttpPipelineExtensions&version=1.0.2
Watir.DotNetCore.HttpPipelineExtensions
A modular set of ASP.NET Core startup and middleware extensions for configuring HTTP request pipelines. This package provides reusable helpers for authentication, diagnostics, Swagger setup, correlation IDs, and shared service registration โ designed to streamline bootstrapping across multiple APIs.
โจ Key Features
๐ Authentication
AddJwtAuthentication()โ Configures Entra IDโbacked JWT authAddTestAuthentication()โ Enables test-mode auth for local/devUseTestAuthMiddleware()โ Injects mock user into pipeline
๐ Diagnostics
LogStartupInfo()โ Logs environment, config, and startup metadata
๐ฆ Swagger
AddSwaggerWithBearer()โ Adds Swagger with JWT Bearer supportUseSwagger()/UseSwaggerUI()โ Standard Swagger setup
๐ Middleware
UseCorrelationMiddleware()โ Adds correlation ID for tracing
๐งฐ Shared Services
AddSharedServices()โ Registers common services (e.g., logging, telemetry)
๐ Installation
dotnet add package Watir.DotNetCore.HttpPipelineExtensions
Usage Example
In Program.cs:
builder.Services.AddSharedServices();
builder.Services.AddAuthorization();
if (useTestAuth)
{
builder.Services.AddTestAuthentication(configuration, "GreetingApi");
}
else
{
builder.Services.AddJwtAuthentication(configuration, "GreetingApi");
}
builder.Services.AddSwaggerWithBearer(
title: "GreetingApi",
version: "v1",
description: "GreetingApi - Secured backend that receives and stores greetings, protected by Entra ID and scoped access");
var app = builder.Build();
StartupDiagnostics.LogStartupInfo(logger, configuration, environment, "GreetingApi");
app.UseCorrelationMiddleware("GreetingApi");
if (app.Environment.IsDevelopment() || Environment.GetEnvironmentVariable("ENABLE_SWAGGER") == "true")
{
app.UseSwagger();
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "GreetingApi v1");
options.RoutePrefix = "swagger";
});
}
if (useTestAuth)
{
var testAuthOptions = app.Services.GetRequiredService<IOptions<TestAuthOptions>>().Value;
app.UseTestAuthMiddleware(testAuthOptions, loggerCategory: "GreetingApi");
}
app.UseHttpsRedirection();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
await app.RunAsync();
๐งช Test Auth Mode
Enable test-mode authentication for local development:
builder.Services.AddTestAuthentication(configuration, "GreetingApi");
app.UseTestAuthMiddleware(options, loggerCategory: "GreetingApi");
๐ License
MIT โ free to use, modify, and distribute.
๐งญ Source & Contributions
Coming soon: [GitHub repo link]
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- Microsoft.AspNetCore.Mvc.Testing (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.10)
- Microsoft.Identity.Web (>= 4.0.1)
- Swashbuckle.AspNetCore (>= 9.0.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.