@aaauth/ protocol (英语)
AAuth 线条格式, 单独使用. 页眉 :, access_mode 规划,
协议常数,以及未经验证的JWT解码. 没有I/O,没有密码.
音轨 draft-hardt-oauth-aauth-protocol-11。 。 。 .
一次性依赖: @hellocoop/httpsig, (中文(简体) ),
为 RFC 8941 结构化字段解析器而导入
(单位:千美元)@hellocoop/httpsig/structured-fields) (中文(简体) ). AAuth-Requirement 是一个词典
财务报告和审定财务报表 AAuth-Capabilities 这是一张Tokens的列表 每一个消费者
软件包以 @hellocoop/httpsig 无论如何,所以解析器是
已安装, 第二次执行相同的语法是第二次
引用和逃避规则 被错误.
npm install @aauth/protocol
授权要求
import { parseRequirementHeader, buildRequirementHeader, UnsupportedRequirementError }
from '@aauth/protocol'
// resource side
res.setHeader('AAuth-Requirement', buildRequirementHeader({
requirement: 'auth-token',
resourceToken,
}))
// agent side
try {
const challenge = parseRequirementHeader(res.headers.get('AAuth-Requirement')!)
} catch (e) {
if (e instanceof UnsupportedRequirementError) {
// MUST NOT treat the response as satisfiable. Surface e.value to the caller.
}
}
公认价值: agent-token, (中文(简体) ), person-token, (中文(简体) ), auth-token, (中文(简体) ), approval, (中文(简体) ),
interaction, (中文(简体) ), clarification, (中文(简体) ), claims。任何其它抛出的东西
UnsupportedRequirementError,携带生 value为 a 202 打电话者
可能继续投票 Location 以防以后的回复有它知道的价值.
requirement=auth-token 需要一个 resource-token 参数和
requirement=interaction 需求 code;一个信头缺失一个是错的
抛出平原 Error。 。 。 . url 打开 requirement=interaction 可选: 当
收件人不在此列 {interaction_endpoint}?code=… 从
发行商公布的元数据. 未知参数被忽略 .
认证能力
buildCapabilitiesHeader(['interaction', 'clarification']) // "interaction, clarification"
parseCapabilitiesHeader('interaction, quantum-consent') // ["interaction"]
解析未识别的值并永不丢出——收件人 MUST 忽略 他们不知道的。 建筑不过滤:代理工会 其PS报告的能力,可能比本图书馆更新.
缺头不是空头. 当信头缺席时, 收件人为 MUST 不承担任何能力.
访问( m)
access_mode 内 /.well-known/aauth-resource.json 是咨询——运行时间
AAuth-Requirement 是权威的. planAccessMode 给一个特工
三个答案,永远不要扔.
const plan = planAccessMode(metadata.access_mode, { hasPersonServer: false })
switch (plan.kind) {
case 'undeclared': // absent or unrecognized — call the resource anyway
case 'satisfiable': // plan.mode is reachable with this setup
case 'unsatisfiable': // skip the resource, show plan.reason
}
未识别值为 undeclared,而不是出错:值空间是 AAuth
访问模式值注册, 和在未知值中断上停留的代理
每次一个值被注册.
unsatisfiable 来自于没有的代理符 ps 索赔。 5个中的3个
模式到达个人服务器,如果没有一个模式,则无法完成:
| 模式 | 无个人服务器 | 为什么 |
|---|---|---|
agent-token | 可调和 | 只有身份;流中没有PS. |
session-token | 可调和 | 由资源管理;资源发行自己的证书. |
person-token | 无法满足 | 代理人必须用个人代币签名,该代币只发行PS. |
auth-token | 无法满足 | 资源令牌在 PS 中交换为 auth 令牌 . |
per-call | 无法满足 | 终止证书——补助金为 r3_per_call 索赔. |
常数
TOKEN_TYP (四个) typ 价值, DWK (四份著名关键文件),
SIGNING_ALG —— 说 Ed25519,根据RFC 9864充分说明. 多态
EdDSA 不得被使用.
JWT 解码
decodeJwtHeader 财务报告和审定财务报表 decodeJwtPayload 解析一个符号的片段并投出
任何畸形的东西. 没有签名验证 . 他们证明什么也没有,从来没有
就其产出作出信任决定.
不在这里
AAuth-Mission 11年,连同IANA的登记一起被删除。 任务
仅在 PS 发行的符号内获得资源, 如 mission_s256 索赔.
这个包中没有任务标题的帮助,也不会有.
许可证
麻省理工学院