Veracity.OAuth.Tokens.Middleware
0.9.0-pre1
Prefix Reserved
dotnet add package Veracity.OAuth.Tokens.Middleware --version 0.9.0-pre1
NuGet\Install-Package Veracity.OAuth.Tokens.Middleware -Version 0.9.0-pre1
<PackageReference Include="Veracity.OAuth.Tokens.Middleware" Version="0.9.0-pre1" />
<PackageVersion Include="Veracity.OAuth.Tokens.Middleware" Version="0.9.0-pre1" />
<PackageReference Include="Veracity.OAuth.Tokens.Middleware" />
paket add Veracity.OAuth.Tokens.Middleware --version 0.9.0-pre1
#r "nuget: Veracity.OAuth.Tokens.Middleware, 0.9.0-pre1"
#:package Veracity.OAuth.Tokens.Middleware@0.9.0-pre1
#addin nuget:?package=Veracity.OAuth.Tokens.Middleware&version=0.9.0-pre1&prerelease
#tool nuget:?package=Veracity.OAuth.Tokens.Middleware&version=0.9.0-pre1&prerelease
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
- The middleware extracts the bearer token from the
Authorizationheader. - The token's
iss(issuer) claim is inspected to determine the token type. - If the issuer host matches the configured Auth0 domain, the token is validated against Auth0's OIDC discovery endpoint.
- Otherwise, the token is validated using the existing B2C/AAD validator from
Stardust.Aadb2c.AuthenticationFilter.Core. - The validated
ClaimsPrincipalis set onHttpContext.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 | 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 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. |
-
net10.0
- Stardust.Aadb2c.AuthenticationFilter.Core (>= 2.5.4)
-
net8.0
- Stardust.Aadb2c.AuthenticationFilter.Core (>= 2.5.4)
-
net9.0
- Stardust.Aadb2c.AuthenticationFilter.Core (>= 2.5.4)
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.