Customer(会員) に紐づく OAuth2 authorization_code フロー (ID 連携) のサポート
- 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) / [#6574](https://github.com/EC-CUBE/ec-cube/issues/6574))。
agentic checkout は**ゲスト購入を基準線**として api4 非依存で成立しますが、**会員(Customer)に紐づく注文**(会員ログイン相当 / UCP の Identity Linking, `ucp:identity`)を実現するには、**エンドユーザー(会員)の同意でその会員に代わってトークンを発行する authorization_code フロー**が必要です。
## 現状
authorization_code グラントは有効ですが、**承認できるのは `Member`(管理者権限)のみ**で、Customer(会員)は拒否されます。
```php
// EventListener/AuthorizationRequestResolveListener.php
$user = $event->getUser();
// システム管理者以外は承認しない
if (!$user instanceof Member || $user->getAuthority()->getId() !== Authority::ADMIN) {
$event->resolveAuthorization(AuthorizationRequestResolveEvent::AUTHORIZATION_DENIED);
return;
}
```
- authorize エンドポイントは `/{admin_route}/authorize`(管理画面 firewall 配下)。
- API firewall は `member_provider` のみ(`DependencyInjection/ApiExtension.php`)→ 発行トークンの subject は常に Member。
つまり、**会員に紐づく OAuth2 トークンは発行できません**。
## 要望
Customer(会員)向けの authorization_code フローを追加してください。
1. **Customer 向け authorize エンドポイント**(会員 firewall 配下。例: `/mypage` 系の認証済みコンテキストで同意)。
2. **Customer を許可する `AuthorizationRequestResolveListener`**(`$user instanceof Customer` を承認)。
3. **Customer 向け API firewall**。**EC-CUBE 本体 core には既に `customer_provider` が存在する**ため、provider を新規実装する必要はなく、これを再利用する想定です(`app/config/eccube/packages/security.yaml`)。
4. 発行トークンの subject が Customer になり、リソースサーバー側で「トークンの会員 = アクセス対象の会員」を担保できること(他会員データへの越境防止)。
## スコープ / 優先度
- agentic checkout の **MVP(ゲスト購入)には不要**。会員 ID 連携を出す段階で必要になります。
- UCP `ucp:identity` capability の実体。ACP は merchant of record ではないため、本機能の要否はプロトコル要件に従います。
- machine-to-machine 認証(`client_credentials` + protocol scope)は **別 issue** で扱います。
## 参照
- `EventListener/AuthorizationRequestResolveListener.php`(Member 限定の承認ロジック)
- `DependencyInjection/ApiExtension.php`(API firewall / provider)
- `Resource/config/routes.php`(authorize / token エンドポイント)
- EC-CUBE 本体 `app/config/eccube/packages/security.yaml`(再利用する `customer_provider`)
---
## 追記 (2026-06-11): UCP における位置づけ
UCP の checkout 自体は **RFC 9421 署名認証で成立し api4 非依存**(EC-CUBE/ec-cube#6574)。本 issue(Customer authorization_code フロー)が必要になるのは、**会員に代わって行動する ID 連携(UCP `ucp:identity`)を実装する段階**に限られる。
- UCP/ACP checkout の MVP(ゲスト購入)には不要。
- EC-CUBE 本体側は会員解決を `CustomerResolverInterface`(標準実装は null=ゲスト)の seam に留めており、本 issue が landing した時点で会員解決実装に差し替える。
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.