SimpleW.Helper.Jwt
26.0.0-rc.20260329-1636
This is a prerelease version of SimpleW.Helper.Jwt.
dotnet add package SimpleW.Helper.Jwt --version 26.0.0-rc.20260329-1636
NuGet\Install-Package SimpleW.Helper.Jwt -Version 26.0.0-rc.20260329-1636
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="SimpleW.Helper.Jwt" Version="26.0.0-rc.20260329-1636" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SimpleW.Helper.Jwt" Version="26.0.0-rc.20260329-1636" />
<PackageReference Include="SimpleW.Helper.Jwt" />
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 SimpleW.Helper.Jwt --version 26.0.0-rc.20260329-1636
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SimpleW.Helper.Jwt, 26.0.0-rc.20260329-1636"
#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 SimpleW.Helper.Jwt@26.0.0-rc.20260329-1636
#: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=SimpleW.Helper.Jwt&version=26.0.0-rc.20260329-1636&prerelease
#tool nuget:?package=SimpleW.Helper.Jwt&version=26.0.0-rc.20260329-1636&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SimpleW.Helper.Jwt
Features
This package lightweight JWT Bearer helpers for SimpleW. It allows you to easily create and validate JWT tokens using HttpIdentity or HttpPrincipal, with full support for roles and custom properties. Supports HS256, HS384, and HS512 algorithms, with optional issuer and audience validation.
Getting Started
The minimal API
using System;
using System.Net;
using SimpleW;
using SimpleW.Helper.Jwt;
namespace Sample {
class Program {
static async Task Main() {
// create options
var options = JwtBearerOptions.Create(
secretKey: "super-secret-key",
issuer: "simplew",
audience: "api"
);
// create an identity
var identity = new HttpIdentity(
isAuthenticated: true,
authenticationType: "Custom",
identifier: "user-123",
name: "John Doe",
email: "john@doe.com",
roles: new[] { "admin" }
);
// create token
string token = JwtBearerHelper.CreateToken(
options,
identity,
lifetime: TimeSpan.FromHours(1)
);
// validate token
if (JwtBearerHelper.TryValidateToken(options, token, out var principal, out var error)) {
Console.WriteLine($"User: {principal.Identity.Name}");
}
else {
Console.WriteLine($"Invalid token: {error}");
}
}
}
}
Documentation
To check out docs, visit simplew.net.
Changelog
Detailed changes for each release are documented in the CHANGELOG.
Contribution
Feel free to report issue.
License
This library is under the MIT License.
| 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. |
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 |
|---|---|---|
| 26.0.0-rc.20260329-1636 | 0 | 3/29/2026 |
| 26.0.0-rc.20260329-1623 | 28 | 3/29/2026 |
| 26.0.0-rc.20260328-1615 | 68 | 3/28/2026 |
| 26.0.0-rc.20260326-1604 | 33 | 3/26/2026 |
| 26.0.0-rc.20260324-1599 | 32 | 3/24/2026 |
| 26.0.0-rc.20260323-1589 | 36 | 3/23/2026 |
| 26.0.0-rc.20260322-1585 | 31 | 3/22/2026 |
| 26.0.0-rc.20260322-1583 | 29 | 3/22/2026 |
| 26.0.0-rc.20260322-1582 | 33 | 3/22/2026 |
