Agentic Commerce 向け client_credentials グラント有効化とプロトコル scope の登録
- Dominant language
- PHP
- Stars
- 9
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
## 背景
EC-CUBE 本体で Agentic Commerce(ACP / UCP)対応を進めています([EC-CUBE/ec-cube#6777](https://github.com/EC-CUBE/ec-cube/issues/6777) 共通基盤 / [#6776](https://github.com/EC-CUBE/ec-cube/issues/6776) ACP checkout / [#6574](https://github.com/EC-CUBE/ec-cube/issues/6574) UCP checkout)。
このうち **checkout エンドポイントへのインバウンド認証**は、AI エージェントプラットフォーム(ChatGPT / Gemini 等)が **自分自身(プラットフォーム)として** merchant の API を呼び出す machine-to-machine 認証です。OAuth2 では `client_credentials` グラントが該当します。
## 現状
`client_credentials` グラントは無効化されており、利用できません。
```yaml
# Resource/config/services.yaml
league_oauth2_server:
authorization_server:
enable_client_credentials_grant: false # ← 無効
```
また、登録できる scope が `read` / `write` のみで、プロトコル別の capability scope を表現できません。
```yaml
# Resource/config/services.yaml
scopes:
available: ['read', 'write']
default: ['read']
```
## 要望
Agentic Commerce のインバウンド認証(machine-to-machine)を実現するため、以下を追加してください。
1. **`client_credentials` グラントの有効化**(設定 or 管理画面のクライアント登録 UI で選択可能に)。
2. **Agentic Commerce プロトコル scope の登録**。EC-CUBE 本体側の `AgentCommerceScopeRegistry` が定める `:` 形式に揃える:
- `acp:checkout` / `acp:catalog`
- `ucp:checkout` / `ucp:cart` / `ucp:catalog` / `ucp:identity`
3. scope ↔ ROLE のマッピング(`ROLE_OAUTH2_` 等)が `read`/`write` 以外でも機能すること。
## 補足
- EC-CUBE 本体(core)は api4 の具象クラスに依存せず、Symfony 標準の `AccessTokenHandlerInterface` 経由でトークン検証する設計です。本 issue は api4 が発行するトークンの **grant 種別と scope 語彙** を拡張するものです。
- 会員(Customer)に紐づく ID 連携(authorization_code grant for Customer)は **別 issue** で扱います(machine-to-machine とは別の関心事)。
## 参照
- `Resource/config/services.yaml`(grant 有効化 / scope 定義)
- `Form/Type/Admin/ClientType.php`(クライアント登録 UI)
- `GraphQL/ScopeValidationRule.php`(scope チェック実装)
---
## 追記 (2026-06-11): 適用範囲の明確化(主に ACP)
UCP 一次仕様と参照実装(Shopware SwagUcp)の精読により、**UCP のインバウンド認証は RFC 9421 HTTP Message Signatures + `UCP-Agent` ヘッダが標準で、OAuth2 / 本 issue に依存しない**ことが確定した(UCP は加盟店が公開する `/.well-known/ucp` の公開鍵でエージェント署名を検証)。
したがって本 issue(`client_credentials` + プロトコル scope)の主対象は次のとおり整理する:
- **主対象 = ACP**: ACP のエージェント→merchant インバウンド認証は merchant 発行の Bearer / OAuth2。`client_credentials` 有効化 + `acp:checkout` / `acp:catalog` scope 登録が ACP checkout(EC-CUBE/ec-cube#6776)の前提。
- **UCP checkout のクリティカルパスからは外れる**(署名検証で成立・api4 非依存)。
- 会員(Customer)に紐づく ID 連携(`ucp:identity` 等)は本 issue ではなく #189 で扱う。
scope 登録は `ucp:*` も将来の MCP / identity 用に有用だが、**本 issue の必須は `acp:*` 中心**で良い。
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.