授权流程
Amazon Bedrock AgentCore Gateway 根据传入的请求评估 Cedar 政策。本节说明授权信息如何从请求流向策略评估。
请求处理
Amazon Bedrock AgentCore Gateway 会处理每个请求中的两条关键信息:
-
JWT 代币-包含有关用户的 OAuth 声明:
{ "sub": "12345678-1234-1234-1234-123456789012", "iss": "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_Vg2efaoGO", "username": "refund-agent", "scope": "aws.cognito.signin.user.admin refund:write", "role": "admin", "department": "finance" } -
MCP 工具调用请求-实际的工具调用:
{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "RefundTool___process_refund", "arguments": { "orderId": "12345", "amount": 450, "reason": "Defective product" } } }
雪松授权申请
网关从两个来源提取信息并构建 Cedar 授权请求。
完成授权申请:
{ "principal": "AgentCore::OAuthUser::\"12345678-1234-1234-1234-123456789012\"", "action": "AgentCore::Action::\"RefundTool___process_refund\"", "resource": "AgentCore::Gateway::\"arn:aws:bedrock-agentcore:us-west-2:123456789012:gateway/refund-gateway\"", "context": { "input": { "orderId": "12345", "amount": 450, "reason": "Defective product" } } }
组件:
- Principal
-
根据 JWT 代币的订阅声明创建:
AgentCore::OAuthUser::"12345678-1234-1234-1234-123456789012" - 处理建议
-
从工具名称中提取:
AgentCore::Action::"RefundTool___process_refund" - 资源
-
网关实例:
AgentCore::Gateway::"arn:aws:bedrock-agentcore:us-west-2:123456789012:gateway/refund-gateway" - 上下文
-
包含工具参数:
{ "input": { "orderId": "12345", "amount": 450, "reason": "Defective product" } }
实体存储-JWT 声明作为标签存储在 OAuthUser 实体上:
{ "uid": { "type": "AgentCore::OAuthUser", "id": "12345678-1234-1234-1234-123456789012" }, "attrs": { "id": "12345678-1234-1234-1234-123456789012" }, "tags": { "username": "refund-agent", "iss": "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_Vg2efaoGO", "scope": "aws.cognito.signin.user.admin refund:write", "role": "admin", "department": "finance" } }
策略评估
雪松评估:
-
校长支票:校长是 OAuthUser吗? ✓(匹配项)
-
操作检查:操作是否是 RefundTool ___process_refund? ✓(匹配项)
-
资源检查:资源是退款网关吗? ✓(匹配项)
-
状况检查:
-
校长有用户名标签吗? ✓(是的,来自智威汤逊)
-
用户名 = “退款代理” 吗? ✓(是的)
-
context.input.amount 是否小于 500? ✓ (450 < 500)
-
结果:允许-所有支票均通过,退款已获得批准。