langchain-enterprise-rbac
Implement enterprise role-based access control for LangChain applications. Use when implementing user permissions, multi-tenant access, or enterprise security controls for LLM applications. Trigger with phrases like "langchain RBAC", "langchain permissions", "langchain access control", "langchain multi-tenant", "langchain enterprise auth".
- License 许可
- MIT
- 最近更新
- 2026-05-26
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- langchain-enterprise-rbac
- author
- Jeremy Longshore <jeremy@intentsolutions.io>
- license
- MIT
- version
- 1.0.0
- description
- Implement enterprise role-based access control for LangChain applications. Use when implementing user permissions, multi-tenant access, or enterprise security controls for LLM applications. Trigger with phrases like "langchain RBAC", "langchain permissions", "langchain access control", "langchain multi-tenant", "langchain enterprise auth".
- allowed-tools
- Read, Write, Edit
- compatible-with
- claude-code, codex, openclaw
02 资源文件 1
- 参考文档references/implementation.md728 B
03 SKILL.md 正文
LangChain Enterprise RBAC
Contents
Overview
Implement role-based access control (RBAC) for LangChain applications with multi-tenant support, model access control, and usage quotas.
Prerequisites
- LangChain application with user authentication
- Identity provider (Auth0, Okta, Azure AD)
- Understanding of RBAC concepts
Instructions
Step 1: Define Permission Model
Create Permission enum with chain, model, feature, and admin permissions. Define roles (viewer, user, power_user, admin) mapping to permission sets.
Step 2: Implement User and Tenant Management
Create Tenant and User models with role-based permission resolution. Users belong to tenants with monthly token limits.
Step 3: Enforce Permissions
Build PermissionChecker with FastAPI decorators (@require_permission) that validate user permissions before chain execution.
Step 4: Control Model Access
Implement ModelAccessController that restricts LLM model access based on user permissions and tenant restrictions.
Step 5: Isolate Tenants
Use context variables (ContextVar) for tenant isolation. Implement TenantScopedVectorStore that filters by tenant ID.
Step 6: Manage Usage Quotas
Build UsageQuotaManager tracking per-tenant token usage with monthly resets and reporting.
See detailed implementation for complete RBAC code.
Output
- Permission model with roles
- User and tenant management
- Model access control
- Tenant isolation
- Usage quotas
Error Handling
| Issue | Cause | Solution |
|---|---|---|
| 403 Forbidden | Insufficient permissions | Check user role assignment |
| Tenant data leak | Missing isolation | Verify ContextVar propagation |
| Quota exceeded | High usage | Upgrade tenant token limit |
Examples
Basic usage: Apply langchain enterprise rbac to a standard project setup with default configuration options.
Advanced scenario: Customize langchain enterprise rbac for production environments with multiple constraints and team-specific requirements.
Resources
Next Steps
Use langchain-data-handling for data privacy controls.
04 同仓库更多 Skills
zustand-store-ts
Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state management, creating global stores, or implementing reactive state patterns with Zustand.
zustand-store-creator
Zustand Store Creator - Auto-activating skill for Frontend Development. Triggers on: zustand store creator, zustand store creator Part of the Frontend Development skill category.
zero-trust-config-helper
Zero Trust Config Helper - Auto-activating skill for Security Advanced. Triggers on: zero trust config helper, zero trust config helper Part of the Security Advanced skill category.
zapier-integration-helper
Zapier Integration Helper - Auto-activating skill for Business Automation. Triggers on: zapier integration helper, zapier integration helper Part of the Business Automation skill category.
zai-cli
Execute z.AI CLI providing vision, search, reader, and GitHub exploration via CLI and MCP. Use when user needs image/video analysis, OCR, UI-to-code conversion, error diagnosis, real-time web search, web page to markdown extraction, or GitHub code exploration. Trigger with phrases like "analyze this image", "search the web for", "read this page", "explore this repo", or "use zai". Requires Z_AI_API_KEY.
yt-research
Research competitor YouTube channels, niches, and trending topics for your content strategy. Use this skill whenever the user says "research channels", "analyze competitors", "find trending topics", "niche analysis", "competitive research", "what are other creators doing", "scrape YouTube channels", or wants to understand the competitive landscape for a specific tool or topic area. Use when working with yt research. Trigger with 'yt', 'research'.