Veracity.OAuth.Tokens.Middleware 0.9.0-pre1

Prefix Reserved
This is a prerelease version of Veracity.OAuth.Tokens.Middleware.
dotnet add package Veracity.OAuth.Tokens.Middleware --version 0.9.0-pre1
                    
NuGet\Install-Package Veracity.OAuth.Tokens.Middleware -Version 0.9.0-pre1
                    
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="Veracity.OAuth.Tokens.Middleware" Version="0.9.0-pre1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Veracity.OAuth.Tokens.Middleware" Version="0.9.0-pre1" />
                    
Directory.Packages.props
<PackageReference Include="Veracity.OAuth.Tokens.Middleware" />
                    
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 Veracity.OAuth.Tokens.Middleware --version 0.9.0-pre1
                    
#r "nuget: Veracity.OAuth.Tokens.Middleware, 0.9.0-pre1"
                    
#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 Veracity.OAuth.Tokens.Middleware@0.9.0-pre1
                    
#: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=Veracity.OAuth.Tokens.Middleware&version=0.9.0-pre1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Veracity.OAuth.Tokens.Middleware&version=0.9.0-pre1&prerelease
                    
Install as a Cake Tool

Veracity.OAuth.Tokens.Middleware

Authentication middleware for Veracity services that supports both Azure AD B2C and Auth0 (IdP V2) token validation in a single handler.

Migration from Stardust.Aadb2c.AuthenticationFilter

If you are currently using Stardust.Aadb2c.AuthenticationFilter with AddB2CAuthentication, migrating to this package adds Auth0 support while keeping your existing B2C configuration unchanged.

Step 1 — Replace the NuGet package

Remove:

Stardust.Aadb2c.AuthenticationFilter

Install:

Veracity.OAuth.Tokens.Middleware

Step 2 — Update authentication registration

Before (B2C only):

using Stardust.Aadb2c.AuthenticationFilter;

builder.Services.AddAuthentication("OAuth2")
	.AddB2CAuthentication();

After (B2C + Auth0):

using Stardust.Aadb2c.AuthenticationFilter.Core;
using Veracity.OAuth.Tokens.Middleware;

// B2C configuration — unchanged from before
B2CGlobalConfiguration.Audience = "your-b2c-audience";
B2CGlobalConfiguration.ValidIssuer = "https://login.microsoftonline.com/.../v2.0";
B2CGlobalConfiguration.B2cTenantUrl = "https://yourtenant.b2clogin.com/yourtenant.onmicrosoft.com";

// Auth0 / IdP V2 configuration — new
Auth0Configuration.Domain = "your-tenant.auth0.com";
Auth0Configuration.Audience = "https://your-api-audience";
// Auth0Configuration.ValidIssuer is optional; defaults to "https://{Domain}/"

// Register the middleware
builder.Services.AddAuthentication(VeracityAuthenticationExtensions.DefaultScheme)
	.AddVeracityAuthentication();

Step 3 — Remove old using statements

Replace any references to Stardust.Aadb2c.AuthenticationFilter namespace with Veracity.OAuth.Tokens.Middleware for the authentication handler registration. The Stardust.Aadb2c.AuthenticationFilter.Core namespace is still used for B2CGlobalConfiguration.

Configuration keys

All configuration uses the ConfigurationManagerHelper pattern.

B2C keys (inherited from Stardust)

Key Description
audience Semicolon-separated list of valid B2C audiences
aadTenant Azure AD tenant name
aadPolicy B2C policy name
issuerHostName Valid B2C issuer URL
b2cTenantUrl B2C tenant base URL

Auth0 / IdP V2 keys (new)

Key Description
IdPV2Domain Auth0 domain (e.g., my-tenant.auth0.com)
IdPV2Audience Semicolon-separated list of valid Auth0 audiences
IdPV2Issuer Valid issuer URL (optional, defaults to https://{Domain}/)

How it works

  1. The middleware extracts the bearer token from the Authorization header.
  2. The token's iss (issuer) claim is inspected to determine the token type.
  3. If the issuer host matches the configured Auth0 domain, the token is validated against Auth0's OIDC discovery endpoint.
  4. Otherwise, the token is validated using the existing B2C/AAD validator from Stardust.Aadb2c.AuthenticationFilter.Core.
  5. The validated ClaimsPrincipal is set on HttpContext.User.

Security

  • All signing keys are fetched over HTTPS from the identity provider's OIDC discovery endpoint.
  • Auth0 tokens are restricted to RS256 signing algorithm.
  • Token lifetime, audience, issuer, and signature are all validated.
  • Unsigned tokens (alg: none) are rejected.
  • Error responses do not leak internal details.

B2C-only mode

If no Auth0 domain is configured (IdPV2Domain is not set), the middleware operates in B2C-only mode, behaving identically to the original AddB2CAuthentication handler.

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 is compatible.  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 is compatible.  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
0.9.0-pre1 168 8/4/2026

Initial release: unified authentication middleware supporting both Azure AD B2C and Auth0 (IdP V2) token validation.