設定管理API
このドキュメントでは、idp-serverの設定管理APIと、全設定タイプにわたる統一された有効/無効機能について説明します。
概要
設定管理APIは、idp-serverの様々な設定エンティティのCRUD操作を提供します。すべての設定タイプは、管理者が設定を削除することなく有効化・無効化できる統一された有効/無効メカニズムをサポートしています。
サポートされている設定タイプ
- クライアント設定 - OAuth 2.0/OpenID Connectクライアント設定
- 認可サーバー設定 - サーバー全体のOAuth/OIDC設定
- フェデレーション設定 - 外部アイデンティティプロバイダー連携設定
- 認証設定 - 認証方式設定(パスワード、MFA等)
- セキュリティイベントフック設定 - セキュリティイベント通知フック
有効/無効機能
基本概念
すべての設定はConfigurableインターフェースを実装し、以下を提供します:
public interface Configurable {
boolean isEnabled(); // 設定が有効
boolean exists(); // 設定がデータベースに存在
default boolean isActive() {
return isEnabled() && exists();
}
}
データベーススキーマ
各設定テーブルにはenabled列が含まれています:
-- 例: client_configuration テーブル
CREATE TABLE client_configuration (
id UUID PRIMARY KEY,
tenant_id UUID NOT NULL,
payload JSONB NOT NULL,
enabled BOOLEAN NOT NULL DEFAULT TRUE,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
フィルタリング動作
一般API(デフォルト動作)
- 有効な設定のみを返却 (
enabled = true) - 無効な設定は自動的にフィルタリングされます
- 認証フロー、トークン発行等で使用
管理API(管理者アクセス)
include_disabledパラメータをサポートし、無効な設定にもアクセス可能- 無効な設定の更新・再有効化に必要
- 完全な管理制御を提供
APIエンドポイント
クライアント設定管理
ベースURL
/v1/management/tenants/{tenant_id}/clients
操作
クライアント作成
POST /v1/management/tenants/{tenant_id}/clients
Content-Type: application/json
{
"client_id": "my-app",
"client_name": "マイアプリケーション",
"client_secret": "secret123",
"grant_types": ["authorization_code"],
"redirect_uris": ["https://app.example.com/callback"],
"enabled": true
}
クライアント一覧取得
GET /v1/management/tenants/{tenant_id}/clients
デ フォルトでは有効なクライアントのみ返却
クライアント取得
GET /v1/management/tenants/{tenant_id}/clients/{client_id}
クライアント更新
PUT /v1/management/tenants/{tenant_id}/clients/{client_id}?include_disabled=true
Content-Type: application/json
{
"client_id": "my-app",
"client_name": "マイアプリケーション(更新済み)",
"enabled": false
}
無効なクライアントを更新するにはinclude_disabled=trueを使用
クライアント削除
DELETE /v1/management/tenants/{tenant_id}/clients/{client_id}
認証設定管理
ベースURL
/v1/management/tenants/{tenant_id}/authentication-configurations
例: パスワード設定
パスワード設定の作成
POST /v1/management/tenants/{tenant_id}/authentication-configurations
Content-Type: application/json
{
"id": "550e8400-e29b-41d4-a716-446655440001",
"type": "password",
"payload": {
"min_length": 8,
"require_uppercase": true,
"require_lowercase": true,
"require_digits": true,
"require_special_chars": false
},
"enabled": true
}
設定の無効化
PUT /v1/management/tenants/{tenant_id}/authentication-configurations/{config_id}
Content-Type: application/json
{
"id": "550e8400-e29b-41d4-a716-446655440001",
"type": "password",
"payload": {
"min_length": 8,
"require_uppercase": true,
"require_lowercase": true,
"require_digits": true,
"require_special_chars": false
},
"enabled": false
}
無効な設定の再有効化
PUT /v1/management/tenants/{tenant_id}/authentication-configurations/{config_id}?include_disabled=true
Content-Type: application/json
{
"id": "550e8400-e29b-41d4-a716-446655440001",
"type": "password",
"payload": {
"min_length": 10,
"require_uppercase": true,
"require_lowercase": true,
"require_digits": true,
"require_special_chars": true
},
"enabled": true
}
フェデレーション設定管理
ベースURL
/v1/management/tenants/{tenant_id}/federation-configurations
例: Google OAuth設定
POST /v1/management/tenants/{tenant_id}/federation-configurations
Content-Type: application/json
{
"id": "550e8400-e29b-41d4-a716-446655440002",
"type": "oidc",
"sso_provider": "google",
"payload": {
"client_id": "google-client-id",
"client_secret": "google-client-secret",
"issuer": "https://accounts.google.com",
"authorization_endpoint": "https://accounts.google.com/o/oauth2/auth",
"token_endpoint": "https://oauth2.googleapis.com/token",
"userinfo_endpoint": "https://openidconnect.googleapis.com/v1/userinfo"
},
"enabled": true
}