分层访问与跨账户访问¶
DotID 允许你按照组织结构授予访问权限,而不必一次只针对一个账户授权。这由两项能力实现,它们都归属于 identity 和 organizations API 系列。
解析你的 organization¶
下面每个 org-scoped route 都需要 path 中有 {orgId}。如果你只知道自己的 account id(例如 token 上的 account_id claim),请解析你的 account 所属的 organization:
GET /identity/v1/accounts/{account_id}/organization
{
"account_id": "9a33e1b6-…",
"organization_id": "7b39dd74-…",
"name": "BROIT Portal",
"role": "management",
"ou_id": "5642e5b0-…",
"ou_name": "Root",
"ou_path": "root",
"mgmt_account_id": "9a33e1b6-…"
}
一个 account 最多属于一个 organization — 且在其中恰好位于一个 OU — 因此结果没有歧义。响应还会告诉你 account 在树中的位置:ou_id、ou_name 和 ou_path(以点分隔路径表示的层级,例如 root.city.store-3;management account 位于其 org 的 Root OU)。该调用是 self-scoped:你只能解析 credential 所绑定 account 的 organization(accountId 必须匹配你的 access key 的 account,或你的 token 的 account_id claim)— 否则返回 403。不属于任何 organization 的 account 返回 404。将返回的 organization_id 传入下面的 {orgId} routes。
OU 范围内的权限分配¶
将权限集分配给 组织单元 (OU) 上的组,而不是分配给单个账户。随后,该授权会应用于该 OU 子树中的每个账户,包括你之后新增的账户,因此无需逐个手动重新分配账户权限。
# Assign permission set PS to group G on an OU; it cascades to accounts under that OU.
POST /identity/v1/organizations/{orgId}/ous/{ouId}/assignments
{ "group_id": "…", "permission_set_id": "…" }
# List / remove OU-scoped assignments
GET /identity/v1/organizations/{orgId}/ous/{ouId}/assignments
DELETE /identity/v1/organizations/{orgId}/ous/{ouId}/assignments/{id}
当所分配的 OU 是某个账户的祖先节点之一时,该账户即受该分配覆盖。位于该子树之外的账户不会因该分配获得任何权限。
账户间传递式委派¶
一个账户可以同意另一个账户在自己的资源上使用其一组权限集。这些同意边可以传递式组合:一条 store → city → area → HQ 委派链,允许上层账户中的主体对下层账户的资源执行操作。
# Delegate scope you hold to another account
POST /identity/v1/accounts/{account_id}/delegations
{ "delegatee_account_id": "…", "scope_permission_set_ids": ["…"] }
# List delegations you granted / received; revoke one
GET /identity/v1/accounts/{account_id}/delegations
GET /identity/v1/accounts/{account_id}/delegations/received
DELETE /identity/v1/accounts/{account_id}/delegations/{delegation_id}
保障委派安全的规则:
范围只会收窄。 有效范围是每一跳上权限集的交集,一条链能够授予的权限永远不会超过其最弱的一跳。
只能委派你已持有的权限。
scope_permission_set_ids中的每个权限集都必须已分配给委派账户,否则请求会被拒绝(422)。深度有上限。 长度超过已配置最大值的链会被拒绝(
422);存在环路也会被拒绝(422)。立即撤销。 对一条边执行
DELETE会在下一次授权时立即生效,不存在缓存的授权。Delegating to an account delegates to everyone in it. The edge names the delegatee account, and every principal of that account — Identity Center users, IAM users, service users — inherits the scope. There is no per-principal narrowing on the delegatee side; choose the delegatee account accordingly.
访问权限会按请求逐次评估:有效、在范围内且未被撤销的链会授权该操作;其他任何情况都会按常规拒绝处理。
These /identity/v1/accounts/{account_id}/delegations calls are reachable over AK/SK, authorized
for the delegating account itself or its organization's management account — any other caller
gets a 403. To make one account a manager for a whole company's accounts (an OU subtree, current
and future), the organization's management account uses the OU → Manager delegation surface — see
Scoped delegation.