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.

エンドポイント

メソッド

パス

用途

POST

/identity/v1/authorize

Simulate one request → ALLOW / DENY

POST

/identity/v1/authorize/batch

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 リクエスト署名で認証されます。[CLI とサービス認証](https://docs.flexgalaxy.ai/dev/dotid/cli-authentication/) の説明に従ってサービス用のキーを発行し、次のヘッダーで各リクエストに署名してください。

ヘッダー

値

Authorization

FGAI-HMAC-SHA256 Credential=<access-key-id>/<date>/<region>/<service>/fgai4_request, SignedHeaders=..., Signature=...

X-FGAI-Date

Request timestamp、yyyyMMddTHHmmssZ (UTC)

X-FGAI-Content-SHA256

リクエスト本文の 16 進 SHA-256

X-FGAI-Security-Token

一時 (STS) 認証情報の場合にのみ指定します

正規の署名詳細(canonical request、signing-key derivation、clock-skew rules)については 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: false for a normal IAM/service user (it is a required boolean — omitting it is rejected). Here user_type is the PDP principal-type discriminator (iam, root, or ic) that selects which evaluator DotID runs — it is not the JWT user_type claim (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 です。

batch endpoint は { "principal": {…}, "context": {…}, "checks": [ { "action": …, "resource": … }, … ] } を受け取ります — すべての checks は 1 つの principal と任意の context を共有します — そして同じ順序で { "results": [ … ] } を返します。

動作

  • Fail-closed. 署名がない、または無効な場合は 401 を返します。認証済みであっても HMAC ではない呼び出し元には 403 を返します。一致する Allow がない場合は DENY (IMPLICIT_DENY) です。一致する Deny は常に優先されます (EXPLICIT_DENY)。

  • Permission required. Without IamPolicySimulateAccess attached to the signing service user, every call is 403 (policy-simulate-required).

  • Own account only. A principal.account_id that is not the signing key's account is 403 and is never evaluated.

  • Rate-limited per access key. A small sustained rate with a short burst; exceeding it returns 429 with a Retry-After header. 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.

関連項目: アカウント/OU/組織ポリシーの組み合わせ方については [階層アクセス](https://docs.flexgalaxy.ai/dev/dotid/hierarchical-access/) を、リソースのアドレス指定については [FRN 形式](https://docs.flexgalaxy.ai/dev/dotid/frn-format/) を参照してください。