本文へスキップ

標準 · 委任

委任と CIBA

人の代わりに動くアプリとエージェント向けの 3 標準: より狭いトークンを他サービスやエージェントへ渡す トークン交換(RFC 8693)、広いスコープではなく具体を求める リッチ認可リクエスト(RFC 9396)、本人端末で承認を求める CIBA(OpenID Connect Client-Initiated Backchannel Authentication)。

各機能は環境ごとにオプトイン: 開発者コンソールでアプリを開き、環境を選び Delegation カードを使います。機密(サーバー側)環境のみ。この Identvia サーバーの運用者は各機能を切れます。https://id.identvia.com/.well-known/openid-configuration のディスカバリが常に有効内容を示します。

トークン交換(RFC 8693)

保持するアクセス トークンを、より短命で狭く、任意で本人の代理エージェントを名指しする新トークンと交換します。

HTTP
POST /oauth/token
Authorization: Basic base64(client_id:client_secret)
Content-Type: application/x-www-form-urlencoded

grant_type=urn:ietf:params:oauth:grant-type:token-exchange
&subject_token=<access token issued to you>
&subject_token_type=urn:ietf:params:oauth:token-type:access_token
&audience=<another Identvia client_id, or the MCP resource>
&scope=openid email
&actor_token=<agent JWT, optional>
&actor_token_type=urn:ietf:params:oauth:token-type:jwt

ルール

  • subject トークンはあなた向けに発行された Identvia アクセス トークンか、aud があなたを指すもの。元アプリとの接続は有効である必要があります。
  • スコープは縮小のみ。 scope を送らないと元スコープから offline_access を除いたもの。offline_access は交換されず、リフレッシュ / ID トークンも出ません。
  • audience(または resource)は有効な Identvia クライアントか Identvia MCP リソースでなければなりません。それ以外は invalid_target。audience が別クライアントのとき sub はそのクライアント向けの pairwise 識別子です。
  • 新トークンは最長 10 分、元より長くはなりません。チェーンは 3 ホップ まで。
  • 元トークンの取り消し、または本人のアプリ切断で、派生トークンは即オフ(introspection は active: false)。
  • 無効な subject / actor トークンは RFC 8693 §2.2.2 どおり invalid_request。

アクター トークン

エージェントを名指しするには actor トークンを送る: アカウントの Agents で登録したエージェント鍵で署名(ES256 / RS256)した JWT。

JSON
header:  { "alg": "ES256", "kid": "<RFC 7638 JWK thumbprint of the agent key>" }
payload: { "sub": "<harness id shown in the person's Agents page>",
           "aud": "https://id.identvia.com",
           "iat": 1700000000, "exp": 1700000120,
           "jti": "<unique, single use>" }

トークンは 5 分以内に期限切れ、各 jti は一回、ブロックされたエージェントは拒否。発行トークンは標準 act クレームを持ち、以前のアクターはその中に入れ子:

JSON
{ "sub": "…", "aud": "oid_…", "scope": "openid email",
  "act": { "sub": "harness-123", "agent_tier": "registered",
           "act": { "sub": "oid_first_app" } } }

RFC 8693 §4.1 に従い、アクセス判断はトップレベル クレームと 現在の アクターのみに基づけます。入れ子のアクターは履歴です。

リッチ認可リクエスト(RFC 9396)

認可リクエストに authorization_details(JSON 配列)を送ります。このサーバーで受理する型: agent_task。

JSON
[{ "type": "agent_task",
   "actions": ["read", "summarize"],
   "locations": ["https://api.example.com/inbox"],
   "datatypes": ["messages"],
   "identifier": "folder-42" }]
  • 以前アプリを信頼していても、同意画面には常に具体的な要求が表示されます。
  • 共通フィールド locations、actions、datatypes、privileges は文字列配列、identifier は文字列。最大 10 件・4 KB。
  • 付与された詳細はトークン応答、アクセス トークンの authorization_details クレーム、introspection、リフレッシュ後に返ります。
  • エラーは invalid_authorization_details を使います。
  • トークン交換は詳細を継承するか狭められます。広げたり新規追加はできません。

CIBA: 本人の端末で承認

コールセンター、キオスク、本人を知るがブラウザ セッションがないバックオフィス担当向け。Poll または Ping を Delegation カードで選びます。

HTTP
POST /oauth/bc-authorize
Authorization: Basic base64(client_id:client_secret)

scope=openid email
&login_hint=person@example.com
&binding_message=Desk 4 · code 7Q2K
&requested_expiry=120

→ 200 { "auth_req_id": "…", "expires_in": 120, "interval": 5 }
  • login_hint はメールアドレス必須。id_token_hint、login_hint_token、署名付きリクエスト(request)、user_code は未対応で invalid_request。
  • メールの有無に関わらず応答は同じなので口座探索には使えません。未知の人は単に承認しません。
  • 同じ binding_message を画面に表示してください。相手は Identvia の受信トレイとメールで、あなたのアプリからのメッセージとして表示されたものを見て、一致することを確認します。最大 48 文字:文字、数字、スペース、基本的な記号(- _ . , : # ( ) · !)。リンク、ドメイン名、メールアドレスは invalid_binding_message で拒否されます。1 人あたりのリクエストは、すべてのアプリを合わせて 1 時間に数件までです。
  • 本人には受信箱へのリンクのメールが届き、承認リンクはありません。承認には新しいパスキーまたは認証アプリ確認が必要です。

Poll モード

HTTP
POST /oauth/token
grant_type=urn:openid:params:grant-type:ciba&auth_req_id=…

→ 400 authorization_pending | slow_down | access_denied | expired_token
→ 200 { "access_token": "…", "id_token": "…", "refresh_token": "…" }

ポーリング間隔は少なくとも interval 秒。速すぎると slow_down で間隔に 5 秒加算。auth_req_id は一回だけ引き換え可能。

Ping モード

アプリ独自ドメインに https 通知エンドポイントを登録し、各リクエストで client_notification_token を送ります。本人が決めると Identvia は {"auth_req_id": "…"} を Authorization: Bearer <your client_notification_token> 付きで POST します。トークンを確認し 204 を返し、poll 同様にトークン エンドポイントを呼びます。push は提供しません。

PHP SDK

PHP
// トークン交換: 他アプリ向けのより狭いトークン。任意でエージェント名
$t = $identvia->tokenExchange($accessToken, audience: 'oid_other_app', scope: 'openid email', actorToken: $agentJwt);
$t->accessToken;              // リフレッシュ トークンなし・短命

// CIBA(poll)
$req = $identvia->cibaAuthorize('person@example.com', scope: 'email', bindingMessage: 'Desk 4 · 7Q2K');
$interval = $req['interval'];
while (($tokens = $identvia->cibaPoll($req['auth_req_id'], $interval)) === null) { sleep($interval); }
// throws TokenException with error access_denied or expired_token when it's over

// CIBA(ping): 通知エンドポイントで
$id = Identvia\Sdk\Identvia::verifyCibaPing($_SERVER['HTTP_AUTHORIZATION'] ?? '', file_get_contents('php://input'), $storedToken);

// サインイン時のリッチ認可リクエスト
$identvia->redirectToSignIn(['authorization_details' => [['type' => 'agent_task', 'actions' => ['read']]]]);

ディスカバリ

有効時、ディスカバリは grant_types_supported に urn:ietf:params:oauth:grant-type:token-exchange と urn:openid:params:grant-type:ciba、加えて authorization_details_types_supported、backchannel_authentication_endpoint、backchannel_token_delivery_modes_supported、backchannel_user_code_parameter_supported: false を列挙します。

どの IETF エージェント識別ドラフトにどの程度従うかはダウンロード内 docs/standards.md に記載。