API 認証と JWT 検証¶
The platform's external authentication model — which host and route admit FGAI-HMAC-SHA256, which admit an OIDC bearer token, and the exact refusal for the other scheme — is stated once in External authentication model. This page covers the second half of that model: how a receiving service validates a bearer token it IS declared to accept.
JWT bearer authentication applies to browser/BFF flows and explicit service-audience workload contracts. It is not the CLI or public tenant-control-plane credential. Human bearer tokens, including platform-admin tokens, are never CLI credentials; platform administration remains private to the admin-console web app.
See CLI authentication for the signed public-API contract.
Realm¶
DotID issues tokens from named realms on the platform Keycloak. Each realm issues its own JWTs from its own signing key.
Realm |
対象ユーザー |
issuer クレーム例 |
|---|---|---|
|
The single tenant entry realm — account-root users, workforce members of accounts, and the platform-level workforce |
Every account and organization is resolved inside flexgalaxy — tenancy rides token claims
(account_id, user_type, org membership), never a realm name. The legacy per-account (acc-*) and
per-org (idc-*) realm model was retired: those realms no longer exist and a token claiming an
acc-*/idc-* issuer cannot be validly issued today. The platform additionally operates
dedicated gate realms for its own surfaces (fgai-admins for platform administration,
staging-access for the staging gate, insider-doc-viewers for the insider portal) — your service
accepts those only if it is one of those platforms. Account-owned service users are non-interactive
and use the Account boundary. These identity populations are isolated and are never merged by
matching email.
Tenant binding: account_id and user_type claims¶
flexgalaxy realm が発行する access token は、認証済み subject の tenant binding を説明する 2 つの claim、account_id と user_type を持ちます。
{
"iss": "https://auth.flexgalaxy.ai/auth/realms/flexgalaxy",
"sub": "9e0f6f96-2f57-4f49-84ef-8d4d12d4f5e1",
"account_id": "11111111-1111-1111-1111-111111111111",
"user_type": "root"
}
account_id— the DotID account UUID the subject is bound to. It is emitted for both account-root users and workforce members of an account. It means "this user belongs to this tenant" — nothing more. It is not the account name and not a realm name.user_type— subject がその account にどのようにバインドされているか:root— account の root user。workforce— account の workforce メンバー。
ルール:
Account-root ステータスは厳密に
user_type == "root"から導出してください。account_idが存在するだけで root と推論してはいけません — workforce ユーザーもaccount_idを持ちますが、root ではありません。「account_idを持つ」を「root である」と扱うと、すべての workforce メンバーを root 相当に静かに昇格させてしまいます。caller の tenant を解決するために
account_idを使用します(per-request scoping および PDP principal context の構築時)。email、username、または realm name から account identity を導出しないでください。Unbound
flexgalaxyusers(例: platform admins)は いずれの claim も受け取りません。account_idがない場合、caller は tenant にバインドされていません。user_typeがない、またはrootでない場合、caller を account root として扱わないでください。代わりに適切な platform-admin、workforce、service-user、または workload-identity path にリクエストをルーティングしてください。
これらの claims は identity context であり、authorization grant ではありません。検証済み token がどの tenant に属するか、および subject がその account の root であるかを service に伝えます。caller が特定の service action を実行してよいとは示しません。first-party service は、policy controlled な account/resource operation では引き続き DotID PDP を呼び出す必要があります。
受信した JWT の検証¶
A receiving service accepts a JWT only where the declaration in
External authentication model admits one: a bearer surface, or a route the
route table marks fgai-hmac+bearer, bearer or workload-jwt. Public tenant routes on the API
edge implement the signed AK/SK and STS path (temporary ASIA credentials, available to any
principal via sts assume-role); JWT support on another audience does not satisfy that public
contract, and on an HMAC-only route the service refuses the bearer rather than validating it.
具体的には、JWT 検証器は次を行う必要があります:
トークンのヘッダ/ペイロードから
issクレームを抽出する。Verify the issuer is the platform realm — exact match:
https://auth.flexgalaxy.ai/auth/realms/flexgalaxy. Reject any other issuer. Do not prefix-match realm families: the legacyacc-*/idc-*families no longer exist, and an exact match is what rejects a rogue realm that merely shares a prefix.realm の JWKS を取得します。取得元は
<issuer>/protocol/openid-connect/certsです。鍵はキャッシュしてください(DotID は定期的にローテーションするため、Cache-Controlヘッダを尊重します)。JWKS に対して署名を検証します。トークンの
kidヘッダで鍵を突き合わせます。標準クレームを検証します:
exp(期限切れでない)、nbf(存在する場合、not before を満たす)、iat(時計のずれを踏まえた妥当性チェック)、aud(サービスの audience identifier と一致)。認可ロジックが依存するサービス固有クレームを検証します(例:
realm_access.roles、groups)。
DotID's own services implement exactly this pattern. There is exactly one customer-facing issuer, so
a validator is a single exact-match check on flexgalaxy — there is no open-acceptance or
prefix-allowlist variant to choose between, and none to mix.
Discovering this resource (RFC 9728)¶
A 401 from a bearer-admitting surface — a browser host, or a machine route declared
fgai-hmac+bearer, bearer or workload-jwt — names where to find this resource's OAuth 2.0
protected-resource metadata:
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://api.flexgalaxy.ai/.well-known/oauth-protected-resource"
A 401 from an HMAC-only machine route does NOT carry that challenge. It challenges the
credential the route actually accepts:
HTTP/1.1 401 Unauthorized
WWW-Authenticate: FGAI-HMAC-SHA256 realm="dotid"
The distinction is deliberate: following an OAuth discovery pointer from a route that refuses OAuth bearer tokens sends a client to a credential exchange that cannot succeed there. The public metadata document still exists and is still anonymous — it just is not advertised by a route that will not accept what it describes.
Fetch that URL to get the RFC 9728 metadata document for the host you called:
curl -sS https://api.flexgalaxy.ai/.well-known/oauth-protected-resource
{
"resource": "https://api.flexgalaxy.ai",
"bearer_methods_supported": ["header"]
}
Those are the two fields a client needs; the document also carries the other RFC 9728 registry
fields. The advertised URL is always https, always carries no port, and always names the host your
request carried — a client may follow it as-is. The document is public: discovery precedes
authentication, so it needs no credential.
FlexGalaxy.AI is multi-tenant, but tenancy is carried in token claims rather than separate realms:
every account authenticates against the single platform realm, so the metadata document deliberately
does not enumerate authorization servers. The authorization server is the platform realm — use its
/.well-known/openid-configuration.
よくあるエラー¶
ステータス |
意味 |
確認ポイント |
|---|---|---|
|
The credential is absent, invalid, or of the wrong family for this route. |
On JWT-bearing browser/workload routes, verify the bearer token's |
|
トークン自体は有効でしたが、PDP が |
レスポンス本文を確認してください。 |
|
principal オブジェクト、action、または resource FRN が不正です。 |
正式な resource 構文とパーサーは FRN format を参照してください。 |
|
API versioning mismatch — 廃止済みパスにリクエストが送信されました。 |
公開 developer API は |
フェデレーション workload token¶
DotID は、外部 OIDC issuer(GitHub Actions、GitLab CI)からフェデレーションされた workload identity にも、RFC 8693 token exchange を通じて access token を発行します。サービスでの検証は、他の DotID 発行 JWT の検証と同一です。同じ realm JWKS、同じ iss / aud / exp ルールを使用します。唯一の違いは、トークンの sub が人間や service-user の ID ではなく DotID workload identity ID であり、トークンには監査の相関付けのために元の CI subject を記録する追加カスタムクレーム federated_subject が含まれることです。その形状は {issuer, sub} です。
federated_subject クレームは監査メタデータとしてのみ扱い、認可判断には決して使用しないでください。他の DotID 発行トークンと同様に、aud、sub、scope クレームが認可の境界です。
交換契約(サービスがこのトークンを 消費 する際の検証ではなく、CI がこのトークンを 取得 するために呼び出すエンドポイント)については、workload-federation.md を参照してください。