Franz.Common.Http.Authentication
1.2.62
dotnet add package Franz.Common.Http.Authentication --version 1.2.62
NuGet\Install-Package Franz.Common.Http.Authentication -Version 1.2.62
<PackageReference Include="Franz.Common.Http.Authentication" Version="1.2.62" />
paket add Franz.Common.Http.Authentication --version 1.2.62
#r "nuget: Franz.Common.Http.Authentication, 1.2.62"
// Install Franz.Common.Http.Authentication as a Cake Addin #addin nuget:?package=Franz.Common.Http.Authentication&version=1.2.62 // Install Franz.Common.Http.Authentication as a Cake Tool #tool nuget:?package=Franz.Common.Http.Authentication&version=1.2.62
Franz.Common.Http.Authentication
A specialized library within the Franz Framework that provides streamlined configurations for JWT Bearer Authentication and Swagger integration in ASP.NET Core applications. This package simplifies secure API development by integrating authentication mechanisms and enhancing API documentation with authentication workflows.
Features
- JWT Bearer Authentication:
- Simplifies configuration and registration of JWT Bearer Authentication for secure APIs.
- Swagger Integration:
- Enhances Swagger documentation with JWT support using
Swashbuckle.AspNetCore.SwaggerGen
.
- Enhances Swagger documentation with JWT support using
- Service Registration:
ServiceCollectionExtensions
for easy setup of authentication services and Swagger enhancements.
Version Information
- Current Version: 1.2.62
- Part of the private Franz Framework ecosystem.
Dependencies
This package relies on:
- Microsoft.AspNetCore.Authentication.JwtBearer (8.0.0): Provides middleware for JWT authentication in ASP.NET Core.
- Swashbuckle.AspNetCore.SwaggerGen (6.5.0): Adds Swagger generation capabilities for APIs with authentication.
- Microsoft.NETCore.App: Core framework for .NET applications.
Installation
From Private Azure Feed
Since this package is hosted privately, configure your NuGet client:
dotnet nuget add source "https://your-private-feed-url" \
--name "AzurePrivateFeed" \
--username "YourAzureUsername" \
--password "YourAzurePassword" \
--store-password-in-clear-text
Install the package:
dotnet add package Franz.Common.Http.Authentication --version 1.2.62
Usage
1. Configuring JWT Bearer Authentication
Use the ServiceCollectionExtensions
to configure JWT authentication:
using Franz.Common.Http.Authentication.Extensions;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddJwtBearerAuthentication(options =>
{
options.Authority = "https://your-auth-server";
options.Audience = "your-api-audience";
});
}
}
This automatically registers the necessary middleware for JWT authentication.
2. Swagger Integration with Authentication
Enable JWT authentication in your Swagger configuration:
using Franz.Common.Http.Authentication.Extensions;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddSwaggerWithJwtSupport(); // Adds Swagger integration with JWT
}
public void Configure(IApplicationBuilder app)
{
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
}
}
3. Protecting API Endpoints
Secure your endpoints with [Authorize]
attributes:
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
[ApiController]
[Route("api/[controller]")]
public class OrdersController : ControllerBase
{
[HttpGet]
[Authorize]
public IActionResult GetOrders()
{
return Ok(new[] { "Order1", "Order2" });
}
}
Integration with Franz Framework
The Franz.Common.Http.Authentication package integrates seamlessly with:
- Franz.Common.Http: Provides complementary HTTP utilities.
- Franz.Common: Core utilities for shared functionality.
Ensure these dependencies are installed to fully leverage the library's capabilities.
Contributing
This package is part of a private framework. Contributions are limited to the internal development team. If you have access, follow these steps:
- Clone the repository.
- Create a feature branch.
- Submit a pull request for review.
License
This library is licensed under the MIT License. See the LICENSE
file for more details.
Changelog
Version 1.2.62
- Added
ServiceCollectionExtensions
for streamlined JWT Bearer Authentication setup. - Integrated Swagger enhancements with
Swashbuckle.AspNetCore.SwaggerGen
. - Full compatibility with Franz.Common.Http.
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. |
-
net8.0
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 8.0.0)
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.5.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Franz.Common.Http.Authentication:
Package | Downloads |
---|---|
Franz.Common.Http.Bootstrap
Shared utility library for the Franz Framework. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.62 | 47 | 1/8/2025 |