外部IDプロバイダー管理
概要
外部IDプロバイダー管理APIは、ソーシャルログインやエンタープライズSSOのための外部IDプロバイダーを設定・管理するエンドポイントを提供します。
エンドポイント一覧
| メソッド | エンドポイント | 説明 |
|---|---|---|
| GET | /api/admin/external-providers | プロバイダー一覧取得 |
| GET | /api/admin/external-providers/:id | プロバイダー詳細取得 |
| POST | /api/admin/external-providers | プロバイダー作成 |
| PUT | /api/admin/external-providers/:id | プロバイダー更新 |
| DELETE | /api/admin/external-providers/:id | プロバイダー削除 |
| POST | /api/admin/external-providers/:id/test | 接続テスト |
| POST | /api/admin/external-providers/:id/enable | プロバイダー有効化 |
| POST | /api/admin/external-providers/:id/disable | プロバイダー無効化 |
プロバイダー一覧取得
設定されている外部IDプロバイダーの一覧を取得します。
エンドポイント
GET /api/admin/external-providers
クエリパラメータ
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
limit | integer | - | 取得件数(デフォルト: 20) |
cursor | string | - | ページネーションカーソル |
type | string | - | プロバイダータイプでフィルタ |
status | string | - | ステータスでフィルタ |
リクエスト例
curl -X GET "https://{tenant-domain}/api/admin/external-providers" \ -H "Authorization: Bearer {token}"レスポンス例
{ "items": [ { "id": "provider_google", "name": "google", "display_name": "Google", "type": "oauth2", "status": "active", "login_count": 1250, "created_at": 1705881600, "updated_at": 1705968000 }, { "id": "provider_okta", "name": "okta-enterprise", "display_name": "Okta SSO", "type": "oidc", "status": "active", "login_count": 500, "created_at": 1705968000, "updated_at": 1706054400 } ], "total": 3}プロバイダー詳細取得
指定されたプロバイダーの詳細情報を取得します。
エンドポイント
GET /api/admin/external-providers/:id
パスパラメータ
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
id | string | ○ | プロバイダーID |
リクエスト例
curl -X GET "https://{tenant-domain}/api/admin/external-providers/provider_google" \ -H "Authorization: Bearer {token}"レスポンス例
{ "id": "provider_google", "name": "google", "display_name": "Google", "type": "oauth2", "status": "active", "config": { "client_id": "123456789.apps.googleusercontent.com", "authorization_endpoint": "https://accounts.google.com/o/oauth2/v2/auth", "token_endpoint": "https://oauth2.googleapis.com/token", "userinfo_endpoint": "https://openidconnect.googleapis.com/v1/userinfo", "scopes": ["openid", "profile", "email"], "response_type": "code", "grant_type": "authorization_code" }, "attribute_mapping": { "email": "email", "name": "name", "picture": "picture", "email_verified": "email_verified" }, "options": { "allow_signup": true, "sync_user_profile": true, "link_existing_accounts": true }, "login_count": 1250, "last_login_at": 1706140800, "created_at": 1705881600, "updated_at": 1705968000}プロバイダー作成
新しい外部IDプロバイダーを設定します。
エンドポイント
POST /api/admin/external-providers
リクエストボディ
| フィールド | 型 | 必須 | 説明 |
|---|---|---|---|
name | string | ○ | プロバイダー名(英数字、ハイフン) |
display_name | string | ○ | 表示名 |
type | string | ○ | プロバイダータイプ(oauth2, oidc, saml) |
config | object | ○ | プロバイダー設定 |
attribute_mapping | object | - | 属性マッピング |
options | object | - | オプション設定 |
プリセットプロバイダー
一般的なプロバイダーはプリセットを使用して簡単に設定できます:
curl -X POST "https://{tenant-domain}/api/admin/external-providers" \ -H "Authorization: Bearer {token}" \ -H "Content-Type: application/json" \ -d '{ "name": "github", "display_name": "GitHub", "type": "oauth2", "preset": "github", "config": { "client_id": "your_github_client_id", "client_secret": "your_github_client_secret" } }'カスタムOIDCプロバイダー
curl -X POST "https://{tenant-domain}/api/admin/external-providers" \ -H "Authorization: Bearer {token}" \ -H "Content-Type: application/json" \ -d '{ "name": "corporate-idp", "display_name": "社内認証", "type": "oidc", "config": { "client_id": "authrim-client", "client_secret": "secret", "issuer": "https://idp.example.com", "discovery_url": "https://idp.example.com/.well-known/openid-configuration", "scopes": ["openid", "profile", "email", "groups"] }, "attribute_mapping": { "email": "email", "name": "name", "groups": "groups" }, "options": { "allow_signup": true, "sync_user_profile": true, "link_existing_accounts": true, "required_groups": ["authrim-users"] } }'レスポンス例
{ "id": "provider_corporate_idp", "name": "corporate-idp", "display_name": "社内認証", "type": "oidc", "status": "inactive", "created_at": 1706140800}プロバイダー更新
既存のプロバイダー設定を更新します。
エンドポイント
PUT /api/admin/external-providers/:id
リクエスト例
curl -X PUT "https://{tenant-domain}/api/admin/external-providers/provider_google" \ -H "Authorization: Bearer {token}" \ -H "Content-Type: application/json" \ -d '{ "display_name": "Googleアカウント", "options": { "allow_signup": false } }'プロバイダー削除
プロバイダーを削除します。
エンドポイント
DELETE /api/admin/external-providers/:id
リクエスト例
curl -X DELETE "https://{tenant-domain}/api/admin/external-providers/provider_old" \ -H "Authorization: Bearer {token}"接続テスト
プロバイダーの設定が正しく機能するかテストします。
エンドポイント
POST /api/admin/external-providers/:id/test
リクエスト例
curl -X POST "https://{tenant-domain}/api/admin/external-providers/provider_corporate_idp/test" \ -H "Authorization: Bearer {token}"レスポンス例(成功)
{ "success": true, "checks": [ { "name": "discovery_endpoint", "status": "passed", "message": "OIDCディスカバリエンドポイントに到達できました" }, { "name": "jwks_endpoint", "status": "passed", "message": "JWKSエンドポイントから公開鍵を取得できました" }, { "name": "authorization_endpoint", "status": "passed", "message": "認可エンドポイントが有効です" } ]}レスポンス例(エラー)
{ "success": false, "checks": [ { "name": "discovery_endpoint", "status": "failed", "message": "OIDCディスカバリエンドポイントに到達できません", "error": "Connection timeout" } ]}プロバイダー有効化
プロバイダーを有効化してログインで使用できるようにします。
エンドポイント
POST /api/admin/external-providers/:id/enable
リクエスト例
curl -X POST "https://{tenant-domain}/api/admin/external-providers/provider_corporate_idp/enable" \ -H "Authorization: Bearer {token}"レスポンス例
{ "id": "provider_corporate_idp", "status": "active", "enabled_at": 1706227200}プロバイダー無効化
プロバイダーを無効化します。
エンドポイント
POST /api/admin/external-providers/:id/disable
リクエスト例
curl -X POST "https://{tenant-domain}/api/admin/external-providers/provider_corporate_idp/disable" \ -H "Authorization: Bearer {token}"レスポンス例
{ "id": "provider_corporate_idp", "status": "inactive", "disabled_at": 1706313600}サポートされるプリセット
| プリセット | タイプ | 説明 |
|---|---|---|
google | oauth2 | |
github | oauth2 | GitHub |
microsoft | oidc | Microsoft / Azure AD |
apple | oidc | Apple |
facebook | oauth2 | |
twitter | oauth2 | Twitter / X |
linkedin | oauth2 | |
slack | oidc | Slack |
okta | oidc | Okta |
auth0 | oidc | Auth0 |
属性マッピング
プロバイダーから取得した属性をAuthrimのユーザー属性にマッピングします。
{ "attribute_mapping": { "email": "email", "name": "displayName", "given_name": "firstName", "family_name": "lastName", "picture": "avatar", "groups": "memberOf" }}左側がAuthrimの属性名、右側がプロバイダーから返される属性名です。