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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Watir.DotNetCore.HttpPipelineExtensions" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Watir.DotNetCore.HttpPipelineExtensions" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Watir.DotNetCore.HttpPipelineExtensions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Watir.DotNetCore.HttpPipelineExtensions --version 1.0.2
                    
#r "nuget: Watir.DotNetCore.HttpPipelineExtensions, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Watir.DotNetCore.HttpPipelineExtensions@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Watir.DotNetCore.HttpPipelineExtensions&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Watir.DotNetCore.HttpPipelineExtensions&version=1.0.2
                    
Install as a Cake Tool

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 auth
    • AddTestAuthentication() โ€” Enables test-mode auth for local/dev
    • UseTestAuthMiddleware() โ€” Injects mock user into pipeline
  • ๐Ÿ“Š Diagnostics

    • LogStartupInfo() โ€” Logs environment, config, and startup metadata
  • ๐Ÿ“ฆ Swagger

    • AddSwaggerWithBearer() โ€” Adds Swagger with JWT Bearer support
    • UseSwagger() / 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 229 10/30/2025
1.0.1 204 10/30/2025
1.0.0 209 10/30/2025