Expand web login current-user profile scopes

This commit is contained in:
Warren Chen 2026-07-07 13:51:30 +09:00
parent d4d2f98296
commit b91b1f95ce
4 changed files with 9 additions and 4 deletions

View File

@ -111,7 +111,7 @@
- Login / Logout return URL allowlist 分開驗證,採 URI origin 與 path segment prefix 比對,不使用原始字串 `StartsWith` - Login / Logout return URL allowlist 分開驗證,採 URI origin 與 path segment prefix 比對,不使用原始字串 `StartsWith`
- API 可用 `Auth:WebLoginUrl` 指定登入頁位置;預設為 `/account/login` - API 可用 `Auth:WebLoginUrl` 指定登入頁位置;預設為 `/account/login`
- `web_login` 可使用 public client + PKCE不要求 client secret。 - `web_login` 可使用 public client + PKCE不要求 client secret。
- `web_login` client 可使用 `openid email profile`,並預留 `profile:basic.read` - `web_login` client 可使用 `openid email profile` 與 current-user `profile:*` scopes這些 scopes 僅能操作 access token subject 自己的資料
### 6.2 OAuth2 API 使用(站點自行 UI ### 6.2 OAuth2 API 使用(站點自行 UI
1) 站點以 API 驗證使用者登入(會員中心提供 login API 1) 站點以 API 驗證使用者登入(會員中心提供 login API

View File

@ -90,7 +90,7 @@
- 使用 Authorization Code + PKCE - 使用 Authorization Code + PKCE
- 需設定 `redirect_uris` - 需設定 `redirect_uris`
- 可使用 `client_type=public` - 可使用 `client_type=public`
- 允許 scope`openid``email``profile``profile:basic.read` - 允許 scope`openid``email``profile`全部 current-user `profile:*`
- `usage=webhook_outbound` - `usage=webhook_outbound`
- 供 Member Center 內部標記「對外 webhook 用」的租戶憑證用途 - 供 Member Center 內部標記「對外 webhook 用」的租戶憑證用途
- 不可用於租戶 API 呼叫 - 不可用於租戶 API 呼叫

View File

@ -78,7 +78,7 @@ Token audience 由 scope → resource registry 計算。
| Usage | Client 型態 / Tenant | 預設 scopes | | Usage | Client 型態 / Tenant | 預設 scopes |
|---|---|---| |---|---|---|
| `web_login` | public 或 confidential互動式登入 | `openid``email``profile``profile:basic.read` | | `web_login` | public 或 confidential互動式登入 | `openid``email``profile`全部 current-user `profile:*` |
| `tenant_api` | confidential必須綁 tenant | `newsletter:events.write``newsletter:list.read``newsletter:subscriptions.read/write`、全部 `profile:*` | | `tenant_api` | confidential必須綁 tenant | `newsletter:events.write``newsletter:list.read``newsletter:subscriptions.read/write`、全部 `profile:*` |
| `platform_service` | confidential可不綁 tenant | `newsletter:events.write.global``newsletter:list.read.global`、全部 `profile:*` | | `platform_service` | confidential可不綁 tenant | `newsletter:events.write.global``newsletter:list.read.global`、全部 `profile:*` |
| `send_api` | confidential必須綁 tenant | `newsletter:send.read/write` | | `send_api` | confidential必須綁 tenant | `newsletter:send.read/write` |

View File

@ -82,7 +82,12 @@ public sealed class AuthResourceRegistryService : IAuthResourceRegistryService
OpenIddictConstants.Scopes.OpenId, OpenIddictConstants.Scopes.OpenId,
OpenIddictConstants.Scopes.Email, OpenIddictConstants.Scopes.Email,
OpenIddictConstants.Scopes.Profile, OpenIddictConstants.Scopes.Profile,
"profile:basic.read" "profile:basic.read",
"profile:basic.write",
"profile:addresses.read",
"profile:addresses.write",
"profile:subscriptions.read",
"profile:subscriptions.write"
], cancellationToken); ], cancellationToken);
await EnsureUsagePermissionsAsync("webhook_outbound", [ await EnsureUsagePermissionsAsync("webhook_outbound", [