Jwt.Net implements JSON Web Token creation and verification for .NET. NuGet packages cover core usage, dependency injection, and ASP.NET Core authentication.
Overview
Jwt.Net is a .NET library for generating and parsing JSON Web Tokens. Applications use it to sign payloads, verify signatures, and read token headers and claims on .NET Framework, .NET Standard, and modern .NET releases.
Encoding and decoding are available through standard APIs and a fluent builder interface. Parsed payloads can be returned as JSON strings or deserialized to .NET types. Validation covers standard time claims: expiration (exp) and not-before (nbf) per RFC 7519.
Developers can supply a ValidateParameters object to relax specific validation steps, swap in a custom IJsonSerializer instead of the default Json.Net-based serializer, or tune JsonNetSerializer settings. JwtValidator handles verification logic.
Extension packages integrate with Microsoft dependency injection and ASP.NET Core: you can register a JWT authentication handler and customize factories that produce Identity or AuthenticationTicket objects. Multiple NuGet packages ship the core library and these extensions separately.
Key features
- JWT encoding and decoding
- Fluent builder API
- exp and nbf validation
- Payload deserialization to .NET types
- Partial validation toggles
- Custom JSON serializer support
- ASP.NET Core auth handler package
- Dependency injection extensions
Use cases
- API authentication tokens in .NET
- ASP.NET Core JWT validation
- Custom claim encoding
- Token header inspection