Authorization - Casbin Use Cases
Data Permissions(数据权限)Implicit Roles & Permissions(隐式角色与权限) RBAC 中权限有两种获取方式: 方式 说明 对应 API 直接赋予 直接把角色/权限分配给用户 GetRolesForUser() / GetPermissionsForUser() 隐式继承 通过角色继承链传递下来的 GetImplicitRolesForUser() / GetImplicitPermissionsForUser() 示例: 12g, alice, adming, admin, superuser GetRolesForUser(alice) → 只返回 [admin](直接分配) GetImplicitRolesForUser(alice) → 返回 [admin, superuser](含继承链) 如果你要做数据过滤(比如”用户能看哪些数据行”),必须用隐式版本,否则继承来的权限会被漏掉 BatchEnforce()(批量鉴权) 一次调用传入多个 [subject, object, ...
Authorization - Casbin Storage
Model Storage Casbin 中模型的三种加载方式 模型是”只读“的 Casbin 的 Model 定义了访问控制逻辑(谁能对什么资源做什么操作),运行时被视为静态配置 没有 API 可以保存或更新模型 - 它是设计时确定的,不是动态变化的 关键区别 方式 适用场景 优点 CONF 文件 大多数情况 清晰、可分享、易维护 代码构建 需要程序化组装模型 灵活、可条件拼接 字符串 配置中心/DB 存储 适合集中管理 三种方式加载的模型内容完全相同,区别只在于来源不同 模型一旦加载完成,后续的动态变化都体现在 Policy(策略) 上,而不是 Model 上 从 .conf 文件加载(推荐) 最常用的方式,把模型定义写在独立的配置文件中,便于分享和讨论 1234567891011121314[request_definition] # 请求定义:请求有哪些字段r = sub, obj, act # sub=主体, obj=客体/资源, act=操作...
Authorization - Casbin Access Control Models
核心架构123456789101112131415161718192021222324252627282930flowchart TB subgraph PERM["PERM 元模型"] direction LR R[Request] --> M[Matchers] --> E[Effect] P[Policy] -.-> M end subgraph Storage["Policy 存储"] direction LR Adapter1[文件] --- Adapter2[数据库] --- Adapter3[S3] end subgraph RoleManager["Role Manager"] direction TB RM[角色管理器] loaders[加载器] RM --> loaders ...
Agentic Harness - Qoder
背景 不是让 Agent 更聪明,而是让错误不可发生 现象 Agent 写代码违反隐式架构规则,lint 失败后陷入修复循环,上下文窗口被塞满,最终偏离目标 根因 - Agent “看不见” “教得更好“(更长 prompt、更多示例、规范文档)有天花板 规则随代码演进、文档在 AI 不可达的地方、不同模型”常识”不一致 解法转向 Harness 工程的核心思路:从”教 Agent 怎么做“转向”让 Agent 自己验证做得对不对“ 靠 linter、测试、架构约束等机械化检查保证正确性,而非依赖 LLM 的”直觉” 本质是把 CI/CD 的拦截时机从合并前提前到写代码时 仓库是 Agent 的操作系统 把散落的知识收进仓库 精简为可按需加载的索引 只编码架构边界而非实现细节 人的角色从执行者变为系统设计者 类比 Harness = LLM 的操作系统,不是增强它的算力,而是给它一个可以可靠运行的环境 CPU LLM 计算能力极强 推理能力极强 不知道硬盘在哪、网络协议是什么 不知道分层规则、文件该放哪 需要 OS 来管理资源、提供抽...
Agentic Harness - Concept
概述 Harness 原意是”马具、线束”,在软件工程中通常指”测试线束”(test harness) - 一组用于运行和监控程序的脚手架代码 在 AI Agent 语境下,Harness 指的是包裹在基础模型(LLM)外层的一整套运行时基础设施,它不是模型本身,而是让模型能够”干活”的那套框架 核心组成 组件 作用 Tool Calling 让 Agent 调用外部工具(搜索、代码执行、API 调用等) Memory Store 短期/长期记忆,让 Agent 跨轮次保留上下文 Orchestration 编排多步推理流程(ReAct、Plan-then-Execute 等) Guardrails 安全护栏、输出校验、权限控制 Observability 日志、追踪、监控 Agent 的决策过程 单独的 LLM 只是一个 text-in / text-out 的函数,Harness 把它变成了一个能 Harness 赋能 LLM 描述 感知环境 通过工具获取实时信息 持久记忆 不局限于单次对话的上下文窗口 自主决策 ...
Agentic Harness - Architecture
Anthropic Agentic Harness: LLM to Coding Agent Claude Code serves as the agentic harness around Claude It provides the tools, context management, and execution environment that turn a language model into a capable coding agent. 增强模型能力 模型本身只会生成文本,Harness 赋予了模型各种能力:读文件、写代码、搜索代码库、在终端执行命令 业界对 Agentic Harness 的核心共识 组件 职责 Agent Harness 包裹 LLM 的运行时基础设施,管理工具调度、上下文工程、安全执行、状态持久化和会话连续性 LLM 只负责推理决策 Harness 组件 Model 本身只是一个推理引擎,不能独立行动,Model 要变成 Agent,需要五个 Harness 组件 Tools 模型的手脚 Read、Write、Edit、B...
MCP Docs - Authorization
Overview Learn how to implement secure authorization for MCP servers using OAuth 2.1 to protect sensitive resources and operations. Authorization in the Model Context Protocol (MCP) secures access to sensitive resources and operations exposed by MCP servers. If your MCP server handles user data or administrative actions, authorization ensures only permitted users can access its endpoints. MCP uses standardized authorization flows to build trust between MCP clients and MCP servers. Its design doesn’t focu...
MCP Docs - Architecture
Overview This overview of the Model Context Protocol (MCP) discusses its scope and core concepts, and provides an example demonstrating each core concept. Because MCP SDKs abstract away many concerns, most developers will likely find the data layer protocol section to be the most useful. It discusses how MCP servers can provide context to an AI application. Scope MCP focuses on context exchange MCP Specification A specification of MCP that outlines the implementation requirements for clients and s...
MCP Docs - Overview
Introduction MCP (Model Context Protocol) is an open-source standard for connecting AI applications to external systems. Using MCP, AI applications like Claude or ChatGPT can connect to data sources (e.g. local files, databases) tools (e.g. search engines, calculators) workflows (e.g. specialized prompts)—enabling them to access key information and perform tasks. Think of MCP like a USB-C port for AI applications. Just as USB-C provides a standardized way to connect electronic devices MCP provides a s...
MCP - Introduction
Background Generative AI applications are a great step forward as they often let the user interact with the app using natural language prompts. However, as more time and resources are invested in such apps, you want to make sure you can easily integrate functionalities and resources in such a way that it’s easy to extend, that your app can cater to more than one model being used, and handle various model intricacies. In short, building Gen AI apps is easy to begin with, but as they grow and become more c...










