Policy simulator¶
Ask the policy simulator whether a principal in your account would be allowed to perform an action on a resource — the same 10-step evaluation the platform runs, so the answer you get is the answer the platform enforces.
It is a simulator, in the shape of AWS IAM's SimulatePrincipalPolicy: you may ask
only about your own account, it requires a dedicated permission on top of your
access key, it is rate-limited, and every call is audited.
端点¶
方法 |
路径 |
用途 |
|---|---|---|
|
|
Simulate one request → |
|
|
Simulate many requests in one call |
Base URL: https://api.flexgalaxy.ai.
Before you can simulate¶
The simulator requires the managed permission IamPolicySimulateAccess to be attached
to the service user whose access key you sign with. A valid access key alone is not
sufficient: without the permission the request is refused with 403
(policy-simulate-required). Attach the policy the same way you attach any managed policy
to a service user; account root users pass without it.
身份认证¶
此端点使用 FGAI-HMAC-SHA256 请求签名进行身份认证,签名凭证为 账户服务用户访问密钥,而不是 bearer token。请按照 [CLI & service authentication](https://docs.flexgalaxy.ai/dev/dotid/cli-authentication/) 中的说明为你的服务签发密钥,然后在每个请求中使用以下请求头进行签名:
请求头 |
值 |
|---|---|
|
|
|
请求时间戳, |
|
请求正文的十六进制 SHA-256 值 |
|
仅在使用临时 (STS) 凭证时提供 |
有关规范签名细节(规范请求、签名密钥派生和时钟偏移规则),请参见 Integrate with AK/SK。
Scoping¶
Decisions are scoped to your key's account: you can only simulate principals and
resources in the account the access key belongs to. The request's principal.account_id
must be that account — a request naming any other account is refused with 403 before
anything is evaluated. There is no way to probe another account.
请求¶
{
"principal": {
"account_id": "<account UUID>",
"user_id": "<user UUID>",
"user_type": "iam",
"ic_session": false
},
"action": "licensing:Device:Read",
"resource": "frn:<account-uuid>:licensing:device/dev-98765",
"context": { "source_ip": "10.0.1.50" }
}
principal — the identity whose access you are simulating (must be in your account). Send
ic_session: falsefor a normal IAM/service user (it is a required boolean — omitting it is rejected). Hereuser_typeis the PDP principal-type discriminator (iam,root, oric) that selects which evaluator DotID runs — it is not the JWTuser_typeclaim (root/workforce) described in API authentication and JWT validation.action — 操作,格式为
service:Resource:Verb(例如licensing:Device:Read)。resource — 目标资源,表示为 [FlexGalaxy Resource Name (FRN)](https://docs.flexgalaxy.ai/dev/dotid/frn-format/)。
context — 由策略条件(
StringEquals、Bool等)评估的可选属性。
响应¶
{
"decision": "ALLOW",
"reason": null,
"matched_statement": "AllowDeviceRead"
}
decision —
ALLOW或DENY。reason — 在
DENY时填充(例如EXPLICIT_DENY、IMPLICIT_DENY)。matched_statement — 决定
ALLOW的策略语句 Sid。
批量端点接收 { "principal": {…}, "context": {…}, "checks": [ { "action": …, "resource": … }, … ] } — 所有检查共享一个 principal 和可选的 context — 并按相同顺序返回 { "results": [ … ] }。
行为¶
失败时默认拒绝。 缺少签名或签名无效时返回
401;已认证但不是 HMAC 调用方时返回403。没有匹配的Allow时结果为DENY(IMPLICIT_DENY);匹配的Deny始终优先(EXPLICIT_DENY)。Permission required. Without
IamPolicySimulateAccessattached to the signing service user, every call is403(policy-simulate-required).Own account only. A
principal.account_idthat is not the signing key's account is403and is never evaluated.Rate-limited per access key. A small sustained rate with a short burst; exceeding it returns
429with aRetry-Afterheader. Refused requests count toward the limit too.Audited. Every call is recorded with the caller (key/principal/account), the question asked, the decision, and any refusal reason.
Semantics match the platform. This is the same policy engine DotID uses internally; no special-cased logic exists on this surface.
另请参阅:[分层访问](https://docs.flexgalaxy.ai/dev/dotid/hierarchical-access/),了解 account/OU/organization 策略如何组合;以及 [FRN 格式](https://docs.flexgalaxy.ai/dev/dotid/frn-format/),了解如何定位资源。