クライアント管理
概要
クライアント管理APIは、OAuthクライアントアプリケーションの登録、設定、シークレット管理を行うエンドポイントを提供します。
エンドポイント一覧
| メソッド | エンドポイント | 説明 |
|---|---|---|
| GET | /api/admin/clients | クライアント一覧取得 |
| GET | /api/admin/clients/:id | クライアント詳細取得 |
| POST | /api/admin/clients | クライアント作成 |
| PUT | /api/admin/clients/:id | クライアント更新 |
| DELETE | /api/admin/clients/:id | クライアント削除 |
| POST | /api/admin/clients/:id/rotate-secret | シークレット再生成 |
| POST | /api/admin/clients/:id/enable | クライアント有効化 |
| POST | /api/admin/clients/:id/disable | クライアント無効化 |
クライアント一覧取得
登録されているOAuthクライアントの一覧を取得します。
エンドポイント
GET /api/admin/clients
クエリパラメータ
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
limit | integer | - | 取得件数(デフォルト: 20、最大: 100) |
cursor | string | - | ページネーションカーソル |
type | string | - | クライアントタイプ(web, native, spa, m2m) |
status | string | - | ステータス(active, disabled) |
リクエスト例
curl -X GET "https://{tenant-domain}/api/admin/clients?type=web" \ -H "Authorization: Bearer {token}"レスポンス例
{ "items": [ { "id": "client_abc123", "name": "My Web App", "type": "web", "status": "active", "redirect_uris": ["https://myapp.example.com/callback"], "created_at": 1705881600, "updated_at": 1705968000 } ], "total": 5, "cursor": null}クライアント詳細取得
指定されたクライアントの詳細情報を取得します。
エンドポイント
GET /api/admin/clients/:id
パスパラメータ
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
id | string | ○ | クライアントID |
リクエスト例
curl -X GET "https://{tenant-domain}/api/admin/clients/client_abc123" \ -H "Authorization: Bearer {token}"レスポンス例
{ "id": "client_abc123", "name": "My Web App", "description": "メインWebアプリケーション", "type": "web", "status": "active", "redirect_uris": [ "https://myapp.example.com/callback", "https://myapp.example.com/silent-callback" ], "post_logout_redirect_uris": [ "https://myapp.example.com/" ], "allowed_origins": [ "https://myapp.example.com" ], "grant_types": ["authorization_code", "refresh_token"], "response_types": ["code"], "token_endpoint_auth_method": "client_secret_post", "scopes": ["openid", "profile", "email"], "id_token_lifetime": 3600, "access_token_lifetime": 3600, "refresh_token_lifetime": 2592000, "created_at": 1705881600, "updated_at": 1705968000}クライアント作成
新しいOAuthクライアントを登録します。
エンドポイント
POST /api/admin/clients
リクエストボディ
| フィールド | 型 | 必須 | 説明 |
|---|---|---|---|
name | string | ○ | クライアント名 |
type | string | ○ | クライアントタイプ(web, native, spa, m2m) |
description | string | - | 説明 |
redirect_uris | string[] | ○ | リダイレクトURI一覧 |
post_logout_redirect_uris | string[] | - | ログアウト後リダイレクトURI |
allowed_origins | string[] | - | 許可オリジン(CORS) |
grant_types | string[] | - | 許可するグラントタイプ |
response_types | string[] | - | 許可するレスポンスタイプ |
token_endpoint_auth_method | string | - | トークンエンドポイント認証方式 |
scopes | string[] | - | 許可するスコープ |
id_token_lifetime | integer | - | IDトークン有効期間(秒) |
access_token_lifetime | integer | - | アクセストークン有効期間(秒) |
refresh_token_lifetime | integer | - | リフレッシュトークン有効期間(秒) |
クライアントタイプ
| タイプ | 説明 | 推奨認証方式 |
|---|---|---|
web | サーバーサイドWebアプリ | client_secret_post/basic |
native | ネイティブアプリ(iOS, Android) | none (PKCE) |
spa | シングルページアプリ | none (PKCE) |
m2m | マシン間通信 | client_secret_post/basic |
リクエスト例
curl -X POST "https://{tenant-domain}/api/admin/clients" \ -H "Authorization: Bearer {token}" \ -H "Content-Type: application/json" \ -d '{ "name": "New Web App", "type": "web", "description": "新規Webアプリケーション", "redirect_uris": ["https://newapp.example.com/callback"], "grant_types": ["authorization_code", "refresh_token"], "scopes": ["openid", "profile", "email"] }'レスポンス例
{ "id": "client_xyz789", "name": "New Web App", "type": "web", "status": "active", "client_secret": "cs_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "redirect_uris": ["https://newapp.example.com/callback"], "created_at": 1706140800}クライアント更新
既存のクライアント設定を更新します。
エンドポイント
PUT /api/admin/clients/:id
リクエスト例
curl -X PUT "https://{tenant-domain}/api/admin/clients/client_abc123" \ -H "Authorization: Bearer {token}" \ -H "Content-Type: application/json" \ -d '{ "name": "Updated Web App", "redirect_uris": [ "https://myapp.example.com/callback", "https://myapp.example.com/callback2" ] }'クライアント削除
クライアントを削除します。
エンドポイント
DELETE /api/admin/clients/:id
リクエスト例
curl -X DELETE "https://{tenant-domain}/api/admin/clients/client_abc123" \ -H "Authorization: Bearer {token}"レスポンス
ステータスコード 204 No Content(ボディなし)
シークレット再生成
クライアントシークレットを再生成します。
エンドポイント
POST /api/admin/clients/:id/rotate-secret
リクエスト例
curl -X POST "https://{tenant-domain}/api/admin/clients/client_abc123/rotate-secret" \ -H "Authorization: Bearer {token}"レスポンス例
{ "id": "client_abc123", "client_secret": "cs_yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", "rotated_at": 1706227200}クライアント有効化
無効化されているクライアントを有効化します。
エンドポイント
POST /api/admin/clients/:id/enable
リクエスト例
curl -X POST "https://{tenant-domain}/api/admin/clients/client_abc123/enable" \ -H "Authorization: Bearer {token}"レスポンス例
{ "id": "client_abc123", "status": "active", "enabled_at": 1706313600}クライアント無効化
クライアントを一時的に無効化します。無効化されたクライアントはトークンを発行できません。
エンドポイント
POST /api/admin/clients/:id/disable
リクエスト例
curl -X POST "https://{tenant-domain}/api/admin/clients/client_abc123/disable" \ -H "Authorization: Bearer {token}"レスポンス例
{ "id": "client_abc123", "status": "disabled", "disabled_at": 1706400000}