Authentication Policy設定ガイド
このドキュメントの目的
認証ポリシー(Authentication Policy)の設定方法を理解します。
所要時間
⏱️ 約25分
Authentication Policyとは
認証 ポリシーはフロー別の認証要件を定義します。
設定内容:
- 利用可能な認証方式
- ACR(Authentication Context Class Reference)マッピング
- 成功条件・失敗条件・ロック条件
設定ファイル構造
authentication-policy/oauth.json
{
"id": "f0864ea0-c4a0-470f-af92-22f995c80b3a",
"flow": "oauth",
"enabled": true,
"policies": [
{
"description": "default",
"priority": 1,
"conditions": {},
"available_methods": [
"password",
"email",
"fido-uaf"
],
"acr_mapping_rules": {
"urn:mace:incommon:iap:gold": ["fido-uaf", "webauthn"],
"urn:mace:incommon:iap:silver": ["email", "sms"],
"urn:mace:incommon:iap:bronze": ["password"]
},
"success_conditions": {
"any_of": [
[
{
"path": "$.password-authentication.success_count",
"type": "integer",
"operation": "gte",
"value": 1
}
]
]
},
"failure_conditions": {
"any_of": []
},
"lock_conditions": {
"any_of": []
}
}
]
}
主要なフィールド
ポリシー基本情報
| フィールド | 必須 | 説明 | 例 |
|---|---|---|---|
id | ✅ | ポリシーID(UUID) | f0864ea0-... |
flow | ✅ | 対象フロ ー | oauth / ciba |
enabled | ✅ | 有効/無効 | true / false |
policies | ✅ | ポリシーリスト | 配列 |
Policyオブジェクト
| フィールド | 必須 | 説明 |
|---|---|---|
description | ❌ | ポリシー説明 |
priority | ✅ | 優先度(高い値が優先) |
conditions | ❌ | 適用条件 |
available_methods | ✅ | UIに表示する認証方式(UIヒント) |
acr_mapping_rules | ❌ | ACRマッピング |
step_definitions | ❌ | 多段階認証のステップ定義 |
success_conditions | ✅ | 成功条件 |
failure_conditions | ❌ | 失敗条件 |
lock_conditions | ❌ | ロック条件 |
auth_session_binding_required | ❌ | セッションバインディング(デフォルト: true) |
Available Methods
UIに表示する認証方式を指定します。この設定はUIヒントとして機能し、フロントエンドが認証画面で表示する認証方式を決定するために使用されます。
{
"available_methods": [
"password",
"email",
"fido-uaf",
"webauthn"
]
}
重要:
- この設定はバックエンドでの認証方式の制限には使用されません
- 認証の成功条件は
success_conditionsで制御してください - Authentication Configuration で登録済みの認証方式のみ指定可能
ACR Mapping Rules
ACR値と認証方式のマッピング:
{
"acr_mapping_rules": {
"urn:mace:incommon:iap:gold": ["fido-uaf", "webauthn"],
"urn:mace:incommon:iap:silver": ["email", "sms"],
"urn:mace:incommon:iap:bronze": ["password"]
}
}
動作:
- クライアントが
acr_values=urn:mace:incommon:iap:goldを要求 → FIDO-UAFまたはWebAuthn認証が必要
Success Conditions
認証成功の条件をJSONPathで定義:
{
"success_conditions": {
"any_of": [
[
{
"path": "$.password-authentication.success_count",
"type": "integer",
"operation": "gte",
"value": 1
}
],
[
{
"path": "$.email-authentication.success_count",
"type": "integer",
"operation": "gte",
"value": 1
},
{
"path": "$.fido-uaf-authentication.success_count",
"type": "integer",
"operation": "gte",
"value": 1
}
]
]
}
}
意味:
- パスワード認証成功 OR(Email認証成功 AND FIDO-UAF認証成功)
サポートされる演算子
| 演算子 | 説明 | 例 |
|---|---|---|
gte | 以上 | success_count >= 1 |
lte | 以下 | failure_count <= 3 |
eq | 等しい | status == "verified" |
ne | 等しくない | status != "locked" |
Step Definitions(多段階認証)
目的: 認証ステップの実行順序とユーザー識別制御を定義します。
step_definitionsとsuccess_conditionsの違い
| 項目 | step_definitions | success_conditions |
|---|---|---|
| 目的 | 認証の実行順序とユーザー識別 | 認証の成功判定 |
| 制御内容 | どの順番で認証を実行するか | どの認証が成功すれば完了か |
| 使用シーン | Email → SMS のような順序制御 | パスワード OR 生体認証 のような条件 |
フィールド一覧
| フィールド | 型 | 必須 | 説明 | 例 |
|---|---|---|---|---|
method | string | ✅ | 認証方式 | "email", "sms", "password" |
order | integer | ✅ | 実行順 序(小さい値が先) | 1, 2, 3 |
requires_user | boolean | ✅ | ユーザーが事前に識別されている必要があるか | false(1st factor)/ true(2nd factor) |
allow_registration | boolean | ❌ | このステップでユーザー登録を許可するか | true / false |
user_identity_source | string | ❌ | ユーザー識別に使用する属性 | "email", "phone_number", "username" |
設定例: Email → SMS 多段階認証
{
"step_definitions": [
{
"method": "email",
"order": 1,
"requires_user": false,
"allow_registration": true,
"user_identity_source": "email"
},
{
"method": "sms",
"order": 2,
"requires_user": true,
"allow_registration": false,
"user_identity_source": "phone_number"
}
]
}
動作:
-
ステップ1(Email認証):
requires_user: false→ ユーザー未特定でもOKallow_registration: true→ 新規ユーザー登録可能- メールアドレスでユーザーを識別
-
ステップ2(SMS認証):
requires_user: true→ ステップ1でユーザーが特定済みである必要allow_registration: false→ 登録不可(既存ユーザーのみ)- 電話番号で検証
1st Factor と 2nd Factor
1st Factor (requires_user: false):
- ユーザー識別フェーズ
- ユーザーが未特定でも実行可能
- 新規ユーザー登録が可能(
allow_registration: true)
2nd Factor (requires_user: true):
- 認証検証フェーズ
- ユーザーが既に特定されている必要あり
- ユーザーを変更できない
使用シーン
- 段階的なユーザー登録: Email認証 → SMS認証で段階的に情報を収集
- ステップアップ認証: 通常ログイン後、重要な操作前にSMS認証を要求
- 複合認証: 複数の認証方式を組み合わせてセキュリティを強化
Auth Session Binding(セッションバインディング)
目的: 認可フローハイジャック攻撃を防止するための設定です。
概要
【認可フローハイジャック攻撃】
1. 攻撃者が認可リクエストを開始 → id=abc123, AUTH_SESSION=xyz789 を取得
2. 攻撃者がURL (id=abc123) を被害者に送信
3. 被害者がそのURLにアクセスして認証しようとする
4. 被害者のブラウザにはAUTH_SESSION Cookieがない
5. 【対策あり】認証時にvalidateAuthSession()が失敗 → 被害者が認証できない
設定
| フィールド | 型 | デフォルト | 説明 |
|---|---|---|---|
auth_session_binding_required | boolean | true | AUTH_SESSION Cookie検証の有効/無効 |
設定例
標準(推奨):
{
"policies": [{
"auth_session_binding_required": true,
"available_methods": ["password"],
"success_conditions": { ... }
}]
}
→ AUTH_SESSION Cookieの検証を実施。認可フローハイジャック攻撃を防止。
無効化(特殊なユースケース向け):
{
"policies": [{
"auth_session_binding_required": false,
"available_methods": ["password"],
"success_conditions": { ... }
}]
}
→ AUTH_SESSION Cookieの検証をスキップ。
検証タイミング
AUTH_SESSION Cookieは以下のエンドポイントで検証されます:
| エンドポイント | 説明 |
|---|---|
POST /password-authentication | パスワード認証 |
POST /totp-authentication | TOTP認証 |
POST /authorize | 認可(同意) |
POST /authorize-with-session | SSO認可 |
例外
以下のフローでは、AUTH_SESSION検証が自動的にスキップされます:
- CIBA(Client Initiated Backchannel Authentication): ブラウザを経由しない認証フロー
- その他のnon-browserフロー
関連ドキュメント
2要素認証(2FA)の設定例
{
"available_methods": ["password", "email"],
"success_conditions": {
"any_of": [
[
{
"path": "$.password-authentication.success_count",
"type": "integer",
"operation": "gte",
"value": 1
},
{
"path": "$.email-authentication.success_count",
"type": "integer",
"operation": "gte",
"value": 1
}
]
]
}
}
動作: パスワードANDメールOTPの両方成功で認証完了
Management APIで登録
API エンドポイント
組織レベルAPI:
POST /v1/management/organizations/{organization-id}/tenants/{tenant-id}/authentication-policies