RA.Utilities.Authentication.JwtBearer
Version 10.0.3
Maintenance release updating the ASP.NET Core JWT bearer integration to the latest .NET 10 servicing patch. No API or behavior changes.
📝 Improvements
- Microsoft.AspNetCore.Authentication.JwtBearer 10.0.12 → 10.0.13.
Version 10.0.2
DependencyInjectionExtensions is split into ServiceCollectionExtensions and ApplicationBuilderExtensions, and the extension methods are refactored to C# 14 extension members. Method names, signatures, and the namespace are unchanged.
⚠️ Breaking Changes
DependencyInjectionExtensionssplit intoServiceCollectionExtensionsandApplicationBuilderExtensions:AddJwtBearerAuthentication()(extension onIServiceCollection) now lives inServiceCollectionExtensions;UseAuth()(extension onIApplicationBuilder) lives inApplicationBuilderExtensions. Both remain in theRA.Utilities.Authentication.JwtBearer.Extensionsnamespace. Call sites need no changes — extension methods resolve by target type — but code that references theDependencyInjectionExtensionsclass name directly (typeof(...), unit-test assertions, reflection) must be updated.
- var t = typeof(DependencyInjectionExtensions);
+ var s = typeof(ServiceCollectionExtensions); // AddJwtBearerAuthentication()
+ var a = typeof(ApplicationBuilderExtensions); // UseAuth()
📝 Improvements
- C# 14 extension members: both classes now declare their methods inside
extension(...)blocks onIServiceCollectionandIApplicationBuilder. The generated extension methods have identical names and signatures, so the refactor is source-compatible for all callers. - The split mirrors the classic ASP.NET Core
Add/Usenaming convention used across the RA.Utilities packages —ServiceCollectionExtensionsfor service registration,ApplicationBuilderExtensionsfor pipeline setup.
Version 10.0.1
🔧 Fixes & Improvements
- Consolidated Options Configuration: All
JwtBearerOptionsbinding and special conversions now happen in a single place (ConfigureJwtBearerOptions), eliminating a subtle bug where the user-providedconfigureOptionscallback could be silently overwritten. The callback now runs last, so programmatic overrides always win. - Fail-Fast Key Validation: The issuer signing key is now validated at construction time rather than on first use, catching misconfiguration immediately at app startup.
- Null-Reference Guard: Added
ArgumentNullException.ThrowIfNullfor theIConfigurationparameter, matching the guard in the DI extension method.
Version 10.0.0
Updated the project version from 10.0.0-rc.2 to the stable release version 10.0.0 in preparation for a production release.
Version 10.0.0-rc.2
This release modernizes the RA.Utilities.Authentication.JwtBearer package, providing a streamlined, configuration-driven approach to setting up JWT Bearer authentication in ASP.NET Core applications.
✨ New Features & Improvements
-
Configuration-Driven Setup:
- Introduced the
AddJwtBearerAuthentication()extension method, which configures JWT Bearer authentication by reading settings directly from theAuthentication:Schemes:Bearersection inappsettings.json. - Eliminates hardcoded values and boilerplate code in
Program.cs.
- Introduced the
-
Smart Configuration Handling:
- Automatically converts
ClockSkewInSecondsfrom your configuration into aTimeSpan. - Automatically converts
IssuerSigningKeyStringinto aSymmetricSecurityKey, simplifying the setup for self-issued tokens.
- Automatically converts
-
Convenience
UseAuth()Method:- Includes a
UseAuth()extension method that registers bothapp.UseAuthentication()andapp.UseAuthorization()with a single call.
- Includes a
-
Updated Documentation:
- The
README.mdhas been updated to provide clear, step-by-step instructions and a completeappsettings.jsonexample.
- The
🚀 Getting Started
Register the services in your Program.cs:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddJwtBearerAuthentication(builder.Configuration);
var app = builder.Build();
app.UseAuth();