JwtLens 0.1.0

dotnet add package JwtLens --version 0.1.0
                    
NuGet\Install-Package JwtLens -Version 0.1.0
                    
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="JwtLens" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JwtLens" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="JwtLens" />
                    
Project file
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 JwtLens --version 0.1.0
                    
#r "nuget: JwtLens, 0.1.0"
                    
#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 JwtLens@0.1.0
                    
#: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=JwtLens&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=JwtLens&version=0.1.0
                    
Install as a Cake Tool

JwtLens

JWT inspection and diagnostics middleware for ASP.NET Core. JwtLens is part of the Lens family for .NET.

Features

  • Captures inbound JWT bearer tokens from ASP.NET Core requests.
  • Captures outbound JWT bearer tokens from HttpClient calls through a delegating handler.
  • Decodes JWT headers and payload claims without validating or storing secrets.
  • Flags expired tokens, tokens nearing expiration, unsigned tokens, and weak algorithms.
  • Redacts sensitive claim values before storage.
  • Tracks claim changes for repeated subjects.
  • Supports environment-guarded registration for safe development-only usage.

Installation

dotnet add package JwtLens

Quick start

using JwtLens.Extensions;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddJwtLens();

var app = builder.Build();

app.UseJwtLens();

app.Run();

Environment-guarded setup

Use the environment-aware overload to register JwtLens only in selected environments:

builder.Services.AddJwtLens(builder.Environment, options =>
{
	options.AllowedEnvironments.Add("Development");
});

var app = builder.Build();
app.UseJwtLens();

When the current environment is not allowed, service registration is skipped and UseJwtLens() is a no-op.

Outbound token capture

Register the JwtLens delegating handler on named or typed HttpClient instances:

builder.Services.AddHttpClient("api")
	.AddHttpMessageHandler<JwtLensDelegatingHandler>();

Configuration

builder.Services.AddJwtLens(options =>
{
	options.IsEnabled = true;
	options.CaptureInboundTokens = true;
	options.CaptureOutboundTokens = true;
	options.WarnIfExpiresWithin = TimeSpan.FromMinutes(5);
});

Security notes

JwtLens is intended for local development, diagnostics, and controlled non-production environments. Avoid enabling token capture in production unless you have reviewed the data handling, redaction, access control, and retention implications for your application.

Project

Source: https://github.com/AnilOptimizely/HttpLens/tree/main/src/JwtLens

Product 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
0.1.0 139 6/21/2026
0.0.1-placeholder 117 5/16/2026