LiveAuth 1.0.1
dotnet add package LiveAuth --version 1.0.1
NuGet\Install-Package LiveAuth -Version 1.0.1
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="LiveAuth" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LiveAuth" Version="1.0.1" />
<PackageReference Include="LiveAuth" />
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 LiveAuth --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: LiveAuth, 1.0.1"
#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 LiveAuth@1.0.1
#: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=LiveAuth&version=1.0.1
#tool nuget:?package=LiveAuth&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
LiveAuth
LiveAuth is a state-aware authorization middleware for ASP.NET Core that addresses core JWT stateless limitations such as delayed revocation and stale role/permission claims.
Why LiveAuth?
Traditional JWT access tokens are self-contained. Once issued, role revocation or session invalidation usually does not apply until token expiry.
LiveAuth keeps JWTs lightweight (session id + version) and validates each request against a session state store, enabling:
- immediate revocation,
- role/permission freshness,
- centralized session control.
Install
dotnet add package LiveAuth
Configure in your API
builder.Services.AddLiveAuth(options =>
{
options.Issuer = builder.Configuration["Jwt:Issuer"] ?? string.Empty;
options.Audience = builder.Configuration["Jwt:Audience"] ?? string.Empty;
options.Secret = builder.Configuration["Jwt:Secret"] ?? string.Empty;
}).AddLiveAuth(options =>
{
options.OverrideRoleFromSession = true;
});
builder.Services.AddSingleton<ISessionStateStore, YourSessionStore>();
appsettings.json
"Jwt": {
"Issuer": "auth.example.com",
"Audience": "liveauth-api",
"Secret": "MySuperSecretKeyForHS256MustBe32Byte!"
}
Sample projects
Samples/WebApiSample: UsesLiveAuthmiddleware (stateful behavior).- Samples/WebApiIdleTimeoutSample
: Web API sample that wiresAddAuthentication(...).AddJwtBearer(...).AddLiveAuth(...)` and demonstrates idle-timeout logout by revoking inactive sessions from the session store. Samples/LiveAuth.TestClient: Console client to generate test tokens and exercise revocation scenarios.
Demo idea
- Run
WebApiSampleand call/securewith a valid token. - Revoke with
/admin/revoke/{sid}. - Call
/secureagain using the same token.- With LiveAuth middleware: request is denied (revocation enforced).
- Without LiveAuth middleware: request may still succeed until token expiry.
Idle Timeout Demo (API + Console Client)
- Run
Samples/WebApiIdleTimeoutSample(defaulthttp://localhost:5000). - Run
Samples/TestClient(or pass a base URL as the first argument). - Observe the flow:
- login succeeds
- immediate
/admincall succeeds - client waits beyond idle timeout
- second
/admincall returns401 Unauthorized /session/{sid}showsisRevoked = true
Production Recommendations
- Use Redis or SQL as distributed session store
- Keep session state immutable (record type)
- Do not register JWT inside LiveAuth
- Do not bypass HTTPS validation in production
- Keep JWT lifetime reasonable even with versioning
| 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. net10.0 was computed. 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.
-
net8.0
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 8.0.15)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.9)
- Microsoft.Extensions.Caching.Abstractions (>= 10.0.2)
- Microsoft.Extensions.Caching.Memory (>= 7.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.2)
- System.IdentityModel.Tokens.Jwt (>= 8.15.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.