コンテンツにスキップ

外部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

クエリパラメータ

パラメータ必須説明
limitinteger-取得件数(デフォルト: 20)
cursorstring-ページネーションカーソル
typestring-プロバイダータイプでフィルタ
statusstring-ステータスでフィルタ

リクエスト例

Terminal window
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

パスパラメータ

パラメータ必須説明
idstringプロバイダーID

リクエスト例

Terminal window
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

リクエストボディ

フィールド必須説明
namestringプロバイダー名(英数字、ハイフン)
display_namestring表示名
typestringプロバイダータイプ(oauth2, oidc, saml
configobjectプロバイダー設定
attribute_mappingobject-属性マッピング
optionsobject-オプション設定

プリセットプロバイダー

一般的なプロバイダーはプリセットを使用して簡単に設定できます:

Terminal window
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プロバイダー

Terminal window
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

リクエスト例

Terminal window
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

リクエスト例

Terminal window
curl -X DELETE "https://{tenant-domain}/api/admin/external-providers/provider_old" \
-H "Authorization: Bearer {token}"

接続テスト

プロバイダーの設定が正しく機能するかテストします。

エンドポイント

POST /api/admin/external-providers/:id/test

リクエスト例

Terminal window
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

リクエスト例

Terminal window
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

リクエスト例

Terminal window
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
}

サポートされるプリセット

プリセットタイプ説明
googleoauth2Google
githuboauth2GitHub
microsoftoidcMicrosoft / Azure AD
appleoidcApple
facebookoauth2Facebook
twitteroauth2Twitter / X
linkedinoauth2LinkedIn
slackoidcSlack
oktaoidcOkta
auth0oidcAuth0

属性マッピング

プロバイダーから取得した属性をAuthrimのユーザー属性にマッピングします。

{
"attribute_mapping": {
"email": "email",
"name": "displayName",
"given_name": "firstName",
"family_name": "lastName",
"picture": "avatar",
"groups": "memberOf"
}
}

左側がAuthrimの属性名、右側がプロバイダーから返される属性名です。