ArturRios.Jwt

A minimal API for creating, validating and reading JSON Web Tokens, with signing-key rotation.

Docs NuGet License: Attribution

A clean, minimal token library — and the only member of the family that depends on nothing else in it, so a service can issue and verify tokens without adopting anything more.

What you get

  • Create signed JWTs (HMAC-SHA256) from a JwtConfiguration.
  • Validate a token signature against a secret, or against a set of keys.
  • Rotate signing keys without invalidating tokens already issued.
  • Read the user id from the id claim, and the kid naming the key that signed the token.
  • Validate a JwtConfiguration with FluentValidation rules before using it.

ArturRios.Util.WebApi builds on this for its authentication middleware.

Install

dotnet add package ArturRios.Jwt

Family dependencies

None.