DotID 外部開発者 API の例¶
この例では、サードパーティ開発者が APaaS パブリック API ゲートウェイを通じてアプリケーションを DotID に連携する方法を示します。
例で使用するアプリケーションは、架空のウィジェットカメラ分析製品である Acme Vision です。Acme Vision は次のことを行います。
自身をサードパーティ APaaS アプリケーションとして登録する。
アプリ固有のスコープを公開する。
PassPort を通じて OIDC ブラウザログインを要求する。
IAM アクションと管理対象 permission set を公開する。
クォータ定義を公開する。
監査イベント体系を公開する。
Account または Organization の管理者がインストールできるようにする。
ユーザーがアプリにアクセスするときに PassPort launch ticket を検証する。
この例では、整理された外部開発者 API モデルを説明します。レガシーな登録エンドポイント、client-registry、未加工の Keycloak Admin API については意図的に扱いません。
実行可能なコード¶
実行可能な例は次の場所にあります。
examples/external-developer-api/
It is a dependency-free Node.js client that performs its integration calls through the published external API below — developer registration, review status, service catalog, tenant installation, and PassPort app entry — using a developer OIDC credential.
この例では、整理された公開 capability API 名を使用します。
/developer/v1/...
/service-catalog/v1/...
/accounts/v1/...
/organizations/v1/...
/passport/v1/...
アーキテクチャ¶
外部開発者が Keycloak Admin API を呼び出したり、DotID サブシステムのテーブルへ直接書き込んだりすることはありません。
公開フローは次のとおりです。
Developer tool
-> public API gateway
-> developer API
-> platform review
-> service catalog publication
-> tenant installation
-> scoped provisioning
-> PassPort app entry
-> third-party application
拒否されるフローは次のとおりです。
Developer tool
-> Keycloak Admin API
-> tenant realm mutation
Keycloak はプラットフォームが所有する実装上の依存関係です。開発者は必要な連携内容を記述し、プラットフォームはその結果の状態を承認、プロビジョニング、監査、調整します。
ホスト名¶
環境 |
ベース URL |
|---|---|
本番環境 |
コンソールの ingress は API サーフェスとは別です。
tenant console: https://console.flexgalaxy.ai
platform admin console: https://admin-console.flexgalaxy.ai
ブラウザコンソールのテストにはコンソールのホスト名を使用します。外部開発者 API のテストには API ベース URL を使用します。
アクターモデル¶
この例では 4 種類のアクターを使用します。
アクター |
説明 |
|---|---|
開発者 |
Acme Vision を構築して登録します。開発者 API 認証情報を使用します。 |
プラットフォームレビュアー |
Platform admin who approves or rejects registrations. |
テナント管理者 |
Acme Vision をインストールする Account または Organization の管理者です。 |
アプリケーションユーザー |
PassPort launch link を通じて Acme Vision に入るユーザーです。 |
認証モデル¶
開発者 API は Keycloak Admin トークンではなく、プラットフォームが発行した開発者認証情報を使用します。
API コントラクトは、次と同等のクレームを持つ bearer token を前提としています。
{
"iss": "<identity-issuer-url>",
"sub": "developer/acme",
"aud": "developer-api",
"developer_id": "acme",
"scope": "developer.services:write developer.services:read"
}
For production, the issuer is https://identity.flexgalaxy.ai.
ライフサイクル¶
External registration is not self-publishing. The implemented lifecycle is:
DRAFT
-> in review (PENDING)
-> approved / rejected
-> active (provisioned, installable) / failed
-> retired (on unregister)
意味:
状態 |
意味 |
|---|---|
|
開発者は登録を編集できます。テナントには表示されません。 |
|
Submitted for platform review; the version is frozen until the reviewer decides. Not visible to tenants. |
|
The platform reviewer's verdict. |
|
Approved registration, provisioned and visible in the service catalog; tenants can install it. |
|
Rejected, or provisioning failed; not in the catalog. |
|
Removed from the catalog by the developer after uninstall. |
Creating a registration submits it for review in the same call, so a fresh
registration is a draft pending review (in_review), never directly active.
The review outcome is a platform-side decision — a developer cannot approve or
reject their own registration. Deleting a registration retires it once no
active tenant installations remain.
Tenant installation is a separate lifecycle. A registration becoming active does not install it into every Account or Organization.
A registration's review states are draft, in_review, approved,
rejected, published, and retired (see the review endpoint below). A
freshly submitted registration starts as a draft pending review and becomes
installable once a platform reviewer approves it.
対象 API サーフェス¶
開発者向け API¶
開発者向け API は次の配下にあります。
/developer/v1
初期対象エンドポイント:
メソッド |
パス |
目的 |
|---|---|---|
|
|
Create and submit a service registration manifest for platform review. The registration starts as a draft pending review and becomes installable only after a platform reviewer approves it. |
|
|
開発者が所有するサービスを一覧表示します。 |
|
|
最新のサービス登録を取得します。 |
|
|
Resubmit a service registration manifest. The create call already submits for review; an already-submitted version is refused as immutable. |
|
|
Fetch the current review state — |
|
|
アクティブなテナントインストールが残っていない場合に、サービス登録を廃止します。 |
Review is a platform-side decision, not a developer API call. When a platform
reviewer approves a registration, it is provisioned, becomes ACTIVE, and is
listed in the service catalog where tenants can install it; a rejection ends it
as FAILED. Developer clients never drive the review step for their own
registrations.
テナントインストール API¶
テナントインストール API は Account と Organization の管理者に公開されます。
/accounts/v1/{account_id}/service-installations
/organizations/v1/{org_id}/service-installations
初期対象エンドポイント:
メソッド |
パス |
目的 |
|---|---|---|
|
|
このアクターがインストールできる公開済みサービスを一覧表示します。 |
|
|
権限、スコープ、クォータ、利用条件を確認します。 |
|
|
スタンドアロン Account にインストールします。 |
|
|
スタンドアロン Account のアクティブなサービスインストールを一覧表示します。 |
|
|
Organization にインストールします。 |
|
|
Organization のアクティブなサービスインストールを一覧表示します。 |
|
|
インストールおよびプロビジョニングのステータスをポーリングします。 |
|
|
アンインストールし、スコープ付きアーティファクトをデプロビジョニングします。 |
PassPort ランタイム API¶
PassPort ランタイム API は次の配下にあります。
/passport/v1
現在実装されているエンドポイントには次が含まれます。
メソッド |
パス |
目的 |
|---|---|---|
|
|
登録済みアプリケーションのメタデータを取得します。 |
|
|
launch link を作成します。 |
|
|
認証後に launch token を交換します。 |
|
|
アプリにバインドされた launch ticket を検証します。 |
開発者登録 API は PassPort アプリケーションレコードを間接的に作成または更新します。開発者は PassPort テーブルに直接書き込むべきではありません。GET /passport/v1/applications/{app_id} の smoke test では、対象環境に存在する app id を指定する必要があります。
サービスマニフェストの例¶
Acme Vision は 1 つのサービス登録マニフェストを送信します。
{
"manifestVersion": "1.0.0",
"serviceId": "acme-vision",
"displayName": "Acme Vision",
"description": "Computer vision analytics for widget cameras.",
"surfaces": {
"iam": {
"service_id": "acme-vision",
"display_name": "Acme Vision",
"actions": [
{
"name": "CameraView",
"audience": "tenant-external",
"description": "View camera streams and metadata."
},
{
"name": "FrameAnalyze",
"audience": "tenant-external",
"description": "Submit frames for analysis."
}
],
"managed_policies": [
{
"name": "AcmeVisionReadOnlyAccess",
"description": "Read camera streams and analysis results.",
"statements": [
{
"Sid": "ReadCameraStreams",
"Effect": "Allow",
"Action": ["acme-vision:CameraView"],
"Resource": ["frn:${account_id}:acme-vision:camera/*"]
}
]
},
{
"name": "AcmeVisionOperatorAccess",
"description": "Use Acme Vision analysis features.",
"statements": [
{
"Sid": "AnalyzeFrames",
"Effect": "Allow",
"Action": ["acme-vision:FrameAnalyze"],
"Resource": ["frn:${account_id}:acme-vision:frame/*"]
}
]
}
],
"managed_permission_sets": [
{
"name": "AcmeVisionViewer",
"policy_names": ["AcmeVisionReadOnlyAccess"]
},
{
"name": "AcmeVisionOperator",
"policy_names": ["AcmeVisionOperatorAccess"]
}
]
},
"quota": {
"catalog": [
{
"key": "camera-streams",
"display_name": "Camera streams",
"unit": "streams",
"scope": "account",
"minimum_value": 0,
"default_value": 50,
"maximum_value": 1000,
"adjustment": {
"mode": "reviewed",
"step": 10,
"apply_endpoint": {
"path": "/api/v1/quotas/camera-streams",
"audience": "acme-vision"
},
"read_endpoint": {
"path": "/api/v1/quotas/camera-streams",
"audience": "acme-vision"
}
}
},
{
"key": "frame-analysis-per-minute",
"display_name": "Frame analysis requests per minute",
"unit": "requests/minute",
"scope": "account",
"minimum_value": 0,
"default_value": 120,
"maximum_value": 10000,
"adjustment": {
"mode": "automatic",
"step": 100,
"apply_endpoint": {
"path": "/api/v1/quotas/frame-analysis-per-minute",
"audience": "acme-vision"
},
"read_endpoint": {
"path": "/api/v1/quotas/frame-analysis-per-minute",
"audience": "acme-vision"
}
}
}
]
},
"audit": {
"events": [
{
"name": "acme-vision.CameraLinked",
"category": "management",
"severity": "medium",
"payload_schema_ref": "https://schemas.acme.example/audit/camera-linked.v1.json"
},
{
"name": "acme-vision.FrameAnalyzed",
"category": "data",
"severity": "low",
"payload_schema_ref": "https://schemas.acme.example/audit/frame-analyzed.v1.json"
}
]
},
"app_launch": {
"launch_path": "/passport/apps/acme-vision",
"required_action": "acmeVision:CameraView",
"resource_frn_pattern": "frn:${account_id}:acme-vision:camera/*",
"allowed_redirect_paths": [
"/passport/apps/acme-vision",
"/partners/acme-vision/dashboard"
],
"installed_accounts": []
},
"backend_metadata": {
"openapi_url": "https://api.acme.example/openapi.json",
"health_url": "https://api.acme.example/health",
"webhook_url": "https://api.acme.example/flexgalaxy/webhooks",
"support_url": "https://acme.example/support",
"data_classification": "tenant-confidential"
}
}
}
The OIDC client is not declared in surfaces.oidc: when omitted, DotID
synthesizes it from your serviceId — client_id = service_id, confidential
by default, realm idc — and validates the synthesized manifest against the
service-registration schema. To control the client explicitly, declare an
oidc surface (client_id, display_name, optional audiences).
命名規則¶
機械識別子には、安定した小文字の ID を使用します。
フィールド |
例 |
規則 |
|---|---|---|
|
|
小文字の slug で、カタログ内でグローバルに一意です。 |
|
|
Derived from the service ID; no tenant/account suffix supplied by developer. |
IAM namespace |
|
The service ID is the action namespace. |
IAM action |
|
CamelCase domain action; policy statements reference |
監査イベント |
|
サービス namespace とイベント名の組み合わせです。 |
クォータキー |
|
DotID によって service ID 配下にスコープ設定される安定した slug です。 |
プラットフォームは、テナント固有のサフィックス付与、realm 配置、生成される client ID、installation ID、プロビジョニングされる resource identifier を管理します。
ウォークスルー¶
ベース URL を設定します。
export FGAI_API_BASE=http://api.dev.fgai.test
export DEVELOPER_TOKEN="<developer bearer token>"
For production, point FGAI_API_BASE at https://api.flexgalaxy.ai instead.
1. Create a service registration¶
curl -fsS \
-X POST "$FGAI_API_BASE/developer/v1/services" \
-H "Authorization: Bearer $DEVELOPER_TOKEN" \
-H "Content-Type: application/json" \
-d @acme-vision.service.json
想定されるレスポンス:
{
"service_id": "acme-vision",
"version": "1.0.0",
"state": "DRAFT",
"manifest_id": "0a8f4c2e-9d31-4b7a-8e5f-1c2b3a4d5e6f",
"links": {
"self": "/developer/v1/services/acme-vision",
"review": "/developer/v1/services/acme-vision/review",
"catalog": "/service-catalog/v1/services/acme-vision"
}
}
The create call submits the registration for platform review: the manifest
stays a draft and the review state becomes in_review. Check it through the
review link:
curl -fsS \
"$FGAI_API_BASE/developer/v1/services/acme-vision/review" \
-H "Authorization: Bearer $DEVELOPER_TOKEN"
{
"service_id": "acme-vision",
"version": "1.0.0",
"state": "DRAFT",
"manifest_id": "0a8f4c2e-9d31-4b7a-8e5f-1c2b3a4d5e6f",
"review_status": "in_review",
"review_notes": []
}
2. Platform review decision¶
Resubmitting the same version while it is in review is refused — the submitted revision is immutable:
curl -sS \
-X POST "$FGAI_API_BASE/developer/v1/services/acme-vision/submit" \
-H "Authorization: Bearer $DEVELOPER_TOKEN" \
-H "Content-Type: application/json" \
-d @acme-vision.service.json
The API returns 409 Conflict (already submitted).
The review outcome is decided by a platform reviewer on the platform review
surface, not by the developer. There is no partner-facing endpoint for the
decision; the developer observes it through GET /service-catalog/v1/services/{serviceId}
and GET /developer/v1/services/{serviceId}/review.
An approved registration is provisioned and becomes ACTIVE; a REJECTED
decision ends it as FAILED. After approval the review state reads
published:
curl -fsS \
"$FGAI_API_BASE/developer/v1/services/acme-vision/review" \
-H "Authorization: Bearer $DEVELOPER_TOKEN"
{
"service_id": "acme-vision",
"version": "1.0.0",
"state": "ACTIVE",
"manifest_id": "0a8f4c2e-9d31-4b7a-8e5f-1c2b3a4d5e6f",
"review_status": "published",
"review_notes": []
}
The registration is now in the catalog and installable by tenants.
3. Retire a service registration¶
すべてのテナントインストールが削除された後、開発者はサービス登録を廃止し、公開カタログから除外できます。
curl -fsS \
-X DELETE "$FGAI_API_BASE/developer/v1/services/acme-vision" \
-H "Authorization: Bearer $DEVELOPER_TOKEN"
想定されるレスポンス:
{
"service_id": "acme-vision",
"version": "1.0.0",
"state": "RETIRED",
"manifest_id": "0a8f4c2e-9d31-4b7a-8e5f-1c2b3a4d5e6f"
}
アクティブなインストールがまだ存在する場合、API は 409 Conflict を返します。先に DELETE /service-catalog/v1/installations/{installation_id} でインストールを削除してください。
4. Tenant installs the service¶
公開済みバージョンがカタログで利用可能になると、Account 管理者はエントリを確認します。
curl -fsS \
"$FGAI_API_BASE/service-catalog/v1/services/acme-vision" \
-H "Authorization: Bearer $ACCOUNT_ADMIN_TOKEN"
The response shows the catalog entry — display name, description, declared actions, quotas, and audit events — with links for review and installation.
Account にインストールします。
curl -fsS \
-X POST "$FGAI_API_BASE/accounts/v1/$ACCOUNT_ID/service-installations" \
-H "Authorization: Bearer $ACCOUNT_ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"service_id": "acme-vision"
}'
想定されるレスポンス:
{
"installation_id": "svcinst_01jz0acmevision",
"scope_type": "ACCOUNT",
"scope_id": "acc_01jz0example",
"service_id": "acme-vision",
"version": "1.0.0",
"status": "ACTIVE",
"idempotent": false
}
ステータスをポーリングします。
curl -fsS \
"$FGAI_API_BASE/service-catalog/v1/installations/svcinst_01jz0acmevision" \
-H "Authorization: Bearer $ACCOUNT_ADMIN_TOKEN"
完了:
{
"installation_id": "svcinst_01jz0acmevision",
"scope_type": "ACCOUNT",
"scope_id": "acc_01jz0example",
"service_id": "acme-vision",
"version": "1.0.0",
"status": "ACTIVE",
"idempotent": false
}
5. Create a PassPort launch link¶
インストール後、ユーザーは PassPort を通じて Acme Vision に入ることができます。
現在の PassPort ランタイムエンドポイント:
curl -fsS \
-X POST "$FGAI_API_BASE/passport/v1/launch-links" \
-H "Authorization: Bearer $ACCOUNT_ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"appId": "acme-vision",
"accountId": "'"$ACCOUNT_ID"'",
"redirectUrl": "https://app.acme.example/",
"scopes": ["openid"],
"ttlSeconds": 900
}'
想定されるレスポンス:
The launch URL is issued by PassPort, for example under https://passport.flexgalaxy.ai in production.
{
"appId": "acme-vision",
"accountId": "acc_01jz0example",
"launchToken": "lt_01jz0example",
"launchUrl": "<passport-launch-url>",
"redirectUrl": "https://app.acme.example/",
"scopes": ["openid"],
"expiresAt": "2026-06-07T12:15:00Z"
}
6. Redeem launch and redirect to application¶
ブラウザは PassPort launch URL に従います。PassPort は必要に応じてユーザーを認証し、インストールとスコープを検証したうえで、アプリにバインドされた launch ticket を発行し、allowlist に登録された Acme Vision URL にのみリダイレクトします。
概念的なリダイレクト:
https://app.acme.example/?launch_ticket=ticket_opaque
launch ticket は短寿命で、アプリにバインドされています。通常のコンソールセッションではありません。
7. Application validates launch ticket¶
Acme Vision は、アプリセッションを作成する前に launch ticket を検証します。
curl -fsS \
-X POST "$FGAI_API_BASE/passport/v1/launch-tickets/validate" \
-H "Content-Type: application/json" \
-d '{
"appId": "acme-vision",
"launchTicket": "ticket_opaque"
}'
想定されるレスポンス:
{
"valid": true,
"appId": "acme-vision",
"accountId": "acc_01jz0example",
"displayName": "Acme Vision",
"subject": "user_01jz0example",
"redirectUrl": "https://app.acme.example/",
"scopes": ["openid"],
"expiresAt": "2026-06-07T12:16:00Z"
}
次の場合、アプリケーションはリクエストを拒否する必要があります。
validが false である。appIddoes not match its own app ID;必須スコープが不足している。
ticket が有効期限切れである。
the account context is not acceptable for the app session.
セキュリティルール¶
Keycloak を直接変更しない¶
サードパーティ開発者に Keycloak Admin 認証情報を渡してはなりません。
プラットフォームは次を管理します。
realm の配置。
テナント固有のサフィックス付与が必要な場合に生成される client ID。
redirect URI の検証。
protocol mapper。
client scope。
テナントスコープのプロビジョニング。
無効化とクリーンアップ。
OIDC client types¶
The example above registers a confidential client: DotID derives the OIDC
client (client_id = acme-vision) from the request envelope and issues a
client_secret (token_endpoint_auth_method: client_secret_basic). A browser or
native app can instead request a public client with public_client: true —
PKCE (S256) and no client_secret. Native (custom-scheme) and loopback
redirects likewise require a public client; a confidential client that declares
one is rejected 400, never silently downgraded to a secret-bearing client.
Public clients are stamped with the aud (flexgalaxy-api) and account_id
mappers automatically. See
OIDC client setup for the full client-type and
redirect-trust model.
HTTPS redirect URL¶
Production registrations は HTTPS redirect URLs を使用する必要があります。local .test hostnames は local simulation fixtures にのみ許可されます。public client 上の production https:// redirect は、その host が app の verified domains (App Links / Universal Links) によって証明された場合にのみ信頼されます — Redirect URIs を参照してください。
本番 origin でワイルドカードを使わない¶
次のような広範な redirect pattern は承認しないでください。
https://*.example.com/*
正確な origin と正確な callback path を優先してください。
https://app.acme.example/passport/callback
アプリスコープの PassPort セッション¶
PassPort entry は通常のコンソールアクセスを付与してはなりません。
アプリが受け取るのは、アプリにバインドされた launch ticket またはアプリスコープの token のみです。その結果生成されるアプリケーションセッションを、コンソールアプリが受け入れてはなりません。
スコープの積集合¶
有効な launch scope は次の積集合です。
アプリが登録した scope。
プラットフォームレビューで承認された scope。
テナントインストールで付与された scope。
launch link で要求された scope。
認証済みユーザーに許可された scope。
いずれかの層で scope が除外されると、アプリはその scope を受け取りません。
冪等性¶
登録 API とインストール API は idempotency key をサポートする必要があります。
推奨ヘッダー:
Idempotency-Key: acme-vision-1.0.0-submit
同じ key と同じ body による繰り返しリクエストは、既存の結果を返す必要があります。同じ key で異なる body の繰り返しリクエストは、競合を返す必要があります。
エラーモデル¶
構造化エラーを使用します。
{
"error_code": "redirect_uri_not_allowed",
"message": "Redirect URI is not registered for this application.",
"details": {
"field": "surfaces.oidc.redirect_uris[1]"
}
}
推奨 HTTP ステータス:
ステータス |
意味 |
|---|---|
|
スキーマ検証外の構文レベルのリクエストエラーです。 |
|
bearer token がないか、無効です。 |
|
認証済みアクターに権限がありません。 |
|
登録、サービス、インストール、またはアプリが見つかりません。 |
|
冪等性、バージョン、または namespace の競合です。 |
|
マニフェストスキーマまたは意味検証に失敗しました。 |
|
レート制限を超過しました。 |
対象外¶
この例では次を扱いません。
Keycloak Admin API の直接使用。
通常のコンソールログイン。
StartPoint account の選択。
platform-admin UI の実装。
本番の課金または商用条件。