Overview
This package provides two LangChain tools for JWT validation and permission checking using Permit:- LangchainJWTValidationTool: Validates JWT tokens against a JWKS endpoint
- LangchainPermissionsCheckTool: Checks user permissions using Permit
Setup
Set up the following environment variables:Credentials
Instantiation
JWT Validation Tool
The JWT Validation tool verifies JWT tokens against a JWKS (JSON Web Key Set) endpoint.Configuration Options
You can initialize the tool with either:- A JWKS URL
- Direct JWKS JSON data
- Environment variable (JWKS_URL)
Permissions Check Tool
The Permissions Check tool integrates with Permit.io to verify user permissions against resources.Invocation
Invoke directly with args
JWT Validation Tool
Permissions Check Tool
Input Formats
The permissions checker accepts different input formats:- Simple string for user (converts to user key):
- Full user object:
Invoke with ToolCall
(TODO)Chaining
- TODO: Add user question and run cells
Additional Demo Scripts
For fully runnable demos, check out the/langchain_permit/examples/demo_scripts
folder in this repository. You’ll find:
- demo_jwt_validation.py – A quick script showing how to validate JWTs using LangchainJWTValidationTool.
- demo_permissions_check.py – A script that performs Permit.io permission checks using LangchainPermissionsCheckTool.
python demo_jwt_validation.py
or python demo_permissions_check.py
(after setting your environment variables) to see these tools in action.