Rig.TUnit.Security
0.1.0-beta.2
dotnet add package Rig.TUnit.Security --version 0.1.0-beta.2
NuGet\Install-Package Rig.TUnit.Security -Version 0.1.0-beta.2
<PackageReference Include="Rig.TUnit.Security" Version="0.1.0-beta.2" />
<PackageVersion Include="Rig.TUnit.Security" Version="0.1.0-beta.2" />
<PackageReference Include="Rig.TUnit.Security" />
paket add Rig.TUnit.Security --version 0.1.0-beta.2
#r "nuget: Rig.TUnit.Security, 0.1.0-beta.2"
#:package Rig.TUnit.Security@0.1.0-beta.2
#addin nuget:?package=Rig.TUnit.Security&version=0.1.0-beta.2&prerelease
#tool nuget:?package=Rig.TUnit.Security&version=0.1.0-beta.2&prerelease
Rig.TUnit.Security
Security family-base:
ISecurityRig,SecurityFixtureBase,SecurityAssertwith HTTP 401/403 helpers.
What this package is
The shared contract for the Security family (.Jwt, .Mtls, .OAuth,
.Policies). Defines the assertion surface every security test expects
— SecurityAssert.HttpIsUnauthorized(response),
HttpIsForbidden(response), ClaimsPrincipalIsAuthenticated(principal)
— so test code looks identical whether you're using JWT, mTLS, OAuth,
or ASP.NET Core Policies.
Install one of the leaves directly for concrete testing.
When to use it
- Authoring a new security-fixture type.
- Writing provider-agnostic security assertions.
- Not for: concrete security testing — install a leaf package.
Prerequisites
- .NET 10 SDK
Quick start
using Rig.TUnit.Security;
var response = await client.SendAsync(request);
await SecurityAssert.HttpIsUnauthorized(response);
Options
| Property | Type | Default | Description |
|---|---|---|---|
DefaultScheme |
string |
"Test" |
Authentication scheme for fixtures that register one |
ValidateIssuer |
bool |
true |
Propagate to JwtBearerOptions when paired with .Jwt |
ValidateAudience |
bool |
true |
Same for audience |
ClockSkew |
TimeSpan |
5m |
Leeway on exp / nbf |
Fixture + helper APIs
Rig.TUnit.Security.ISecurityRigRig.TUnit.Security.Fixtures.SecurityFixtureBaseRig.TUnit.Security.Assertions.SecurityAssert
Per-test isolation
Security fixtures typically own ephemeral key material (JWT signing
keys, certificate chains) per-test, keyed by IsolationKey. Each leaf
details the specifics.
Parallelism + performance
§9 — N/A: family-base; per-provider. JWT signing is cheap; mTLS
certificate generation is expensive (~20 ms) and cached per fixture.
Troubleshooting
SecurityAssert.HttpIsUnauthorizedfails on expected-401 — check the API's[Authorize]wiring actually runs before your handler; a missingapp.UseAuthorization()lets requests through as 200.
Provider quirks + edge cases
- Every security leaf integrates with the real
JwtBearerHandler/CertificateAuthenticationmiddleware — no test-only bypass. That is deliberate; bypassed auth is not a valid security test.
Benchmarks
§12 — N/A: family-base; concrete leaves have individual
*Benchmarks.cs entries under tests/Rig.TUnit.Benchmarks/.
Related docs
License
MIT. See LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- Bogus (>= 35.6.1)
- Microsoft.Extensions.Configuration (>= 10.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.0)
- Rig.TUnit.Core (>= 0.1.0-beta.2)
- TUnit.Core (>= 1.34.5)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Rig.TUnit.Security:
| Package | Downloads |
|---|---|
|
Rig.TUnit.Security.Policies
TUnit fixture for ASP.NET Core authorisation policies - claim-based, role-based, and resource-based assertions. |
|
|
Rig.TUnit.All
Meta-package containing every Rig.TUnit.* package. DISCOURAGED — prefer per-feature or per-stack meta-packages (Rig.TUnit, Rig.TUnit.Microservices). |
|
|
Rig.TUnit.Security.Jwt
TUnit fixture for issuing test JWTs and a JWKS endpoint backed by an in-memory signing key. |
|
|
Rig.TUnit.Security.OAuth
TUnit fixture for OAuth flows (auth-code+PKCE, client-credentials) against an in-process IdentityServer or stub provider. |
|
|
Rig.TUnit.Security.Mtls
TUnit fixture for mutual-TLS scenarios - test CAs, leaf certs, and revocation list assertions. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-beta.2 | 47 | 4/27/2026 |
| 0.0.0-alpha.0.14 | 49 | 4/26/2026 |