IAM roles and STS AssumeRole¶
DotID は AWS IAM と同じ方法で roles をモデル化します。role は account 内の引き受け可能な identity であり、trust policy(誰が引き受けられるか)と、アタッチされた permission policies(何ができるか)を持ちます。caller は STS AssumeRole によりロールを引き受け、そのロールの account 内でロールの permissions に従って動作する短命 credentials を受け取ります。これが cross-account access の背後にある仕組みです。
Authentication¶
Role management と STS は account admin により self-managed です。FGAI-HMAC-SHA256 を使用して account service-user access key でリクエストに署名します([CLI & service authentication](https://docs.flexgalaxy.ai/dev/dotid/cli-authentication/) を参照)。bearer JWT も受け入れられます。あなたの credential は 1 つの account に固定されています — その account 内の roles のみを管理します。
Base URL: https://api.flexgalaxy.ai.
Roles¶
Method |
Path |
Purpose |
|---|---|---|
|
|
ロールを作成する |
|
|
roles を一覧する |
|
|
ロールを取得する |
|
|
trust policy / description / max session を更新する |
|
|
ロールを削除する |
|
|
permission policy をアタッチする |
|
|
アタッチ済み policies を一覧する |
|
|
policy をデタッチする |
ロールを作成する¶
The trust_policy is required and answers "who may assume me". name is required;
description, path, and max_session_duration (seconds) are optional.
Field names on the wire are
snake_case. Every DotID request and response body usessnake_case(trust_policy,role_frn,access_key_id, …). A body spelled in camelCase binds nothing and the API answers400with"role_frn: must not be blank"— a message that reads like a missing field when the real cause is the spelling.
{
"name": "DeviceReader",
"description": "Read-only device access, assumable by the ops tooling account.",
"max_session_duration": 3600,
"trust_policy": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": { "Account": ["acc-0a1b2c3d4e5f"] },
"Action": "sts:AssumeRole"
}
]
}
}
response は作成された role で、その id を含みます:
{
"id": "8b2f0a3e-1c4d-4e6f-9a01-2b3c4d5e6f70",
"account_id": "11111111-1111-1111-1111-111111111111",
"name": "DeviceReader",
"trust_policy": { "…": "…" },
"max_session_duration": 3600,
"version": 1,
"created_at": "2026-07-07T09:00:00Z"
}
Trust policy¶
各 statement は、Effect が Allow、Action が sts:AssumeRole を含み、Principal block が caller に一致し、すべての Condition が満たされる場合に caller を許可します。評価は fail-closed です。一致する Allow がなければ caller は拒否され、一致する Deny は常に勝ちます。
Principal は以下を受け付けます:
Form |
意味 |
|---|---|
|
任意の caller。 |
|
その account 内の任意の principal。 |
|
[FRN](https://docs.flexgalaxy.ai/dev/dotid/frn-format/) による特定の principal。 |
|
アカウント全体(account-form FRN)。 |
任意で sts:ExternalId condition による shared secret を要求します:
{
"Effect": "Allow",
"Principal": { "Account": ["acc-0a1b2c3d4e5f"] },
"Action": "sts:AssumeRole",
"Condition": { "StringEquals": { "sts:ExternalId": "shared-secret-xyz" } }
}
permission policy をアタッチする¶
ロールに許可する内容を付与するため、あなたの account の IAM policies の 1 つを id でアタッチします:
curl -fsS -X POST \
"https://api.flexgalaxy.ai/identity/v1/accounts/$ACCOUNT_ID/roles/$ROLE_ID/policies" \
-H "Content-Type: application/json" \
-d '{ "policy_id": "a1b2c3d4-…" }'
# + FGAI-HMAC-SHA256 signing headers
STS AssumeRole¶
credential を、ロールにスコープされた temporary credentials と交換します。
Method |
Path |
Purpose |
|---|---|---|
|
|
ロールを引き受ける → temporary credentials |
Request¶
role_frn and role_session_name are required; duration_seconds and external_id
are optional. Pass external_id when the target role's trust policy requires one.
{
"role_frn": "frn:acc-target00acct:iam:role/DeviceReader",
"role_session_name": "ops-tooling-run-42",
"duration_seconds": 3600,
"external_id": "shared-secret-xyz"
}
duration_seconds is clamped to [900, role.max_session_duration].
Response¶
{
"assumed_role_frn": "frn:acc-target00acct:iam:role/DeviceReader",
"account_id": "22222222-2222-2222-2222-222222222222",
"role_session_name": "ops-tooling-run-42",
"access_key_id": "ASIA…",
"secret_access_key": "…",
"session_token": "…",
"expiration": "2026-07-07T10:00:00Z"
}
The returned credentials are temporary (ASIA… key id). Use them to sign
subsequent requests with FGAI-HMAC-SHA256, adding the session token as the
X-FGAI-Security-Token header. Requests signed with these credentials act in the
role's account with the role's permissions — so authorization decisions for the
session resolve from the role's attached policies (see
Policy simulator).
Failures¶
署名がない、または無効な場合は
401を返します。role が存在しない場合、またはその trust policy が caller を拒否する場合、call は
403を返します — 2 つのケースは区別できないため、caller は別 account の roles を探査できません。
Assume a role from a workload identity (CI, machine persona)¶
A workload identity holds no key at all — it authenticates by presenting its
IdP-issued OIDC token to the token exchange and receiving a
short-lived DotID-signed bearer. A bearer is not a CLI command credential, so a machine
persona that needs to transact takes one more step: it assumes a role and receives the
same temporary ASIA… credential a human gets from Identity Center.
The route is a workload twin of the one above, not the same one:
Method |
Path |
Caller |
|---|---|---|
|
|
An access key (FGAI-HMAC) or a console/federated JWT |
|
|
A workload token from the exchange, as |
Sending a workload token to the first route returns 401 invalid_token with
unknown_realm: token-exchange — that is "wrong door", not "denied". The request and
response bodies are identical on both routes.
One-time setup by the account admin¶
Grant the workload identity the STS audience. Attach an IAM policy allowing
iam:ExchangeTokenon the STS service resource, so the workload can mint a token the STS lane accepts:{ "Version": "2024-01-01", "Statement": [ { "Sid": "ExchangeForSts", "Effect": "Allow", "Action": "iam:ExchangeToken", "Resource": "frn::iam:service/dotid-sts" } ] }
This grants nothing but the right to ask. The audience puts the workload's token on the STS lane; which roles it may assume is still decided, per role, by the trust policy below.
Name the workload in the role's trust policy. A workload identity's principal FRN uses the
workload-identityresource type — it is not auser, and a trust policy written for one can never be satisfied by the other:{ "Effect": "Allow", "Principal": { "FGAI": ["frn:acc-0a1b2c3d4e5f:iam:workload-identity/<workload-identity-id>"] }, "Action": "sts:AssumeRole" }
Attach the role's permissions as managed policies through
POST /identity/v1/accounts/{account_id}/roles/{role_id}/policies. An assumed session resolves the role's attached policies; an inline role policy is not read.
The call¶
# 1. exchange the CI OIDC token for a workload token on the STS lane
ACCESS_TOKEN=$(curl -fsS -X POST https://api.flexgalaxy.ai/oauth2/token \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "grant_type=urn:ietf:params:oauth:grant-type:token-exchange" \
--data-urlencode "subject_token=$OIDC_TOKEN" \
--data-urlencode "subject_token_type=urn:ietf:params:oauth:token-type:jwt" \
--data-urlencode "audience=dotid-sts" | jq -r .access_token)
# 2. assume the role — no signing, the bearer IS the credential here
curl -fsS -X POST https://api.flexgalaxy.ai/identity/v1/workload/sts/assume-role \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "role_frn": "frn:acc-0a1b2c3d4e5f:iam:role/Publisher",
"role_session_name": "ci-run-42" }'
The response is the same ASIA… credential shape as above. From here the workload signs
requests with FGAI-HMAC-SHA256 exactly like any other principal — including through the
fgai CLI:
FGAI_SECRET_ACCESS_KEY="$SECRET_ACCESS_KEY" \
fgai configure --name ci-publisher \
--account-id "$ACCOUNT_ID" \
--access-key-id "$ACCESS_KEY_ID" \
--session-token "$SESSION_TOKEN" \
--expiration "$EXPIRATION"
Record --expiration: fgai auth status then reports why a credential started
returning 401 instead of the command failing with no explanation.
Telling the failures apart¶
Status |
意味 |
|---|---|
|
Wrong route — you sent a workload token to |
|
Either the token is not on the STS lane (missing the |
|
The body was spelled in camelCase. The wire is |
Revoke a live session at any time with POST /identity/v1/sts/revoke-session
({"access_key_id": "ASIA…"}); the credential stops working within about half a minute.
→ workforce users を管理¶
assumed role の一般的な用途は headless workforce(Identity Center)user management です。identitycenter:User:* を role に付与する managed policy を attach し、それを assume して、interactive login なしに temporary credentials で Identity Center directory の users を管理します。実例は Manage workforce (Identity Center) users headlessly (M2M) を参照してください。
関連項目¶
[FRN format](https://docs.flexgalaxy.ai/dev/dotid/frn-format/)
[Hierarchical access](https://docs.flexgalaxy.ai/dev/dotid/hierarchical-access/)