> ## Documentation Index
> Fetch the complete documentation index at: https://auth0.generaltranslation.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Actions で Akamai の補足シグナルを使用する

<Warning>
  **Auth0 Supplemental Signals は現在 Early Access 段階です。**

  この機能を使用することにより、Okta の [Master Subscription Agreement](https://www.okta.com/legal) に定められている該当の無料トライアル条件に同意したものとみなされます。Auth0 製品のリリース段階について詳しくは、[Product Release Stages](/docs/ja-JP/troubleshoot/product-lifecycle/product-release-stages) を参照してください。
</Warning>

<Info>
  **開始する前に**

  Actions で Akamai の補足シグナルを使用するには、次を行う必要があります。

  * [Akamai をリバースプロキシとして構成する](/docs/ja-JP/customize/custom-domains/self-managed-certificates)
  * [Akamai を構成して補足シグナルを送信する](./configure-akamai-supplemental-signals)
</Info>

Akamai をリバースプロキシとして構成し、Auth0 に補足シグナルを送信するように設定している場合、それらのシグナルで提供されるデータを [Auth0 Actions](/docs/ja-JP/customize/actions) で使用できます。

<div id="supported-supplemental-signals-by-action-trigger">
  ## Action トリガーごとのサポートされる補助シグナル
</div>

| トリガー                   | 補助シグナル オブジェクト                                                                | イベント オブジェクト                                                                                                                                                                                 |
| ---------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ログイン                   | <ul><li><code>akamaiBot</code></li><li><code>akamaiUserRisk</code></li></ul> | <a href="/docs/ja-JP/customize/actions/explore-triggers/signup-and-login-triggers/login-trigger/post-login-event-object"><code>authentication.riskAssessment.supplemental.akamai</code></a> |
| Pre-User Registration  | なし                                                                           | 該当なし                                                                                                                                                                                        |
| Post-User Registration | なし                                                                           | 該当なし                                                                                                                                                                                        |
| Send Phone Message     | なし                                                                           | 該当なし                                                                                                                                                                                        |
| Post-Challenge         | なし                                                                           | 該当なし                                                                                                                                                                                        |
| Post-Change Password   | なし                                                                           | 該当なし                                                                                                                                                                                        |
| Credentials Exchange   | なし                                                                           | 該当なし                                                                                                                                                                                        |

<div id="supplemental-signal-object-schemas">
  ## 補助シグナルオブジェクトのスキーマ
</div>

`akamaiBot` と `akamaiUserRisk` オブジェクトには、認証フローをカスタマイズするために使用できる複数のプロパティが含まれています。

<ResponseField name="akamaiBot" type="object">
  <Expandable>
    <ResponseField name="action" type="string">
      Akamai Bot Manager の結果として実行されるアクション。

      Example: `Monitor`
    </ResponseField>

    <ResponseField name="botCategory" type="string[]">
      Akamai Bot Manager の結果におけるボットカテゴリ。

      Example: `["Web Search Engine Bots"]`
    </ResponseField>

    <ResponseField name="botScore" type="number">
      Akamai Bot Manager の結果におけるボットスコア。

      Example: `90`
    </ResponseField>

    <ResponseField name="botScoreResponseSegment" type="string">
      Akamai Bot Manager の結果におけるボットスコアのレスポンスセグメント。

      Example: `aggressive`
    </ResponseField>

    <ResponseField name="botnetId" type="string">
      Akamai Bot Manager の結果におけるボットネット ID。

      Example: `googlebot`
    </ResponseField>

    <ResponseField name="type" type="string">
      Akamai Bot Manager の結果のタイプ。

      Example: `Akamai-Categorized Bot`
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="akamaiUserRisk" type="object">
  <Expandable>
    <ResponseField name="action" type="string">
      Akamai によるユーザーリスク評価のアクション。

      Example: `monitor`
    </ResponseField>

    <ResponseField name="allow" type="number">
      Akamai によるユーザーリスク評価の許可ステータス。

      Example: `0`
    </ResponseField>

    <ResponseField name="emailDomain" type="string">
      ユーザーのメールドメイン。

      Example: `example.com`
    </ResponseField>

    <ResponseField name="general" type="object">
      Akamai によるユーザーリスク評価の全般的なリスク。

      Example: `{ aci: “0”, db: “Chrome 85”, di: “0fc91b5ec42f5a471c16a85e3e388ca57697c1a9”, do: “Mac OX X 10” }`
    </ResponseField>

    <ResponseField name="ouid" type="string">
      ユーザーの OUID。

      Example: `m534264`
    </ResponseField>

    <ResponseField name="requestid" type="string">
      ユーザーのリクエスト ID。

      Example: `19e22e`
    </ResponseField>

    <ResponseField name="risk" type="object">
      Akamai によるユーザーリスク評価のリスク情報。

      Example: `{ ugp: “ie/M”, unp: “432/H” }`
    </ResponseField>

    <ResponseField name="score" type="number">
      Akamai によるユーザーリスク評価のスコア。

      Example: `0`
    </ResponseField>

    <ResponseField name="status" type="number">
      Akamai によるユーザーリスク評価のステータス。

      Example: `4`
    </ResponseField>

    <ResponseField name="trust" type="object">
      Akamai によるユーザーリスク評価の信頼情報。

      Example: `{ udbp: "Chrome85", udfp: "25ba44ec3b391ba4ce5fbbd2979635e254775werwe", udop: "Mac OS X 10", ugp: "FR", unp: "12322", utp: "weekday_3" }`
    </ResponseField>

    <ResponseField name="username" type="string">
      ユーザーのユーザー名。

      Example: `testuser@example.com`
    </ResponseField>

    <ResponseField name="uuid" type="string">
      Akamai によるユーザーリスク評価の UUID。

      Example: `86b37525-8047-4a3c-8d7a-23e99666da05`
    </ResponseField>
  </Expandable>
</ResponseField>

<div id="use-cases">
  ## ユースケース
</div>

<AccordionGroup>
  <Accordion title="Akamai Account Protector の結果に基づいてセッションを失効させる">
    `akamaiUserRisk.score` プロパティに基づいてセッションを失効させる方法の例を次に示します。

    ```javascript theme={null}
    exports.onExecutePostLogin = async (event, api) => {
      const userRiskHeader = event.authentication?.riskAssessment?.supplemental?.akamai?.akamaiUserRisk;
      if (userRiskHeader?.score && userRiskHeader?.score >= 90) {
            console.log('User is deemed high risk.');
            // これによりセッション Cookie が失効し、ログインが拒否されます。
            api.session.revoke('Session revoked, User risk score is greater than 90.');
        }
    };

    ```

    `api.access.deny` メソッドではなく `api.session.revoke` メソッドを使用している点に注意してください。`revoke` メソッドを使用すると、ユーザーがアプリケーションをリフレッシュした際に、Akamai の補足シグナルが認証リクエストと共に送信され、ポストログインの Action フローがトリガーされることが確実になります。
  </Accordion>

  <Accordion title="Akamai Bot Manager の結果に基づいて多要素認証 (MFA) を求める">
    `akamaiBot.score` プロパティに基づいて MFA（多要素認証）を強制する方法の例を次に示します。

    #### MFA を強制する

    この Action は次の 2 つのタスクを実行します。

    1. **[アプリ メタデータ](/docs/ja-JP/manage-users/user-accounts/metadata/metadata-fields-data) を更新する**: score プロパティが指定した値を超えた場合、そのセッションで MFA が必要であることを記録します。
    2. **MFA を必須にする**: score プロパティが指定した値を超えた場合、またはそのセッションで MFA が必要であることを示すレコードがアプリ メタデータに存在する場合に、MFA を強制します。

    ```javascript theme={null}
    exports.onExecutePostLogin = async (event, api) => {
      const userRiskHeader = event.authentication?.riskAssessment?.supplemental?.akamai?.akamaiUserRisk;

      if (userRiskHeader?.score && userRiskHeader?.score >= 90) {
        console.log(`Setting app metadata for session id: ${event.session?.id}`);
        api.user.setAppMetadata(`mfa_required_${event.session?.id}`, true);
      }

      if (userRiskHeader?.score && userRiskHeader?.score >= 90 ||
          event.user.app_metadata[`mfa_required_${event.session?.id}`]) {
            console.log(`Requiring MFA FOR Session id: ${event.session?.id}`);
            api.multifactor.enable('any', {allowRememberBrowser: false});
      }
    };

    ```

    #### アプリ メタデータをクリーンアップする

    この Action は、ユーザーが MFA を正常に完了した後に、アプリ メタデータからセッション固有の MFA 情報を削除します。

    ```javascript theme={null}
    exports.onExecutePostLogin = async (event, api) => {
      const mfaMethod = event.authentication?.methods.find((method) => {
        return method.name === 'mfa';
      });

      if (mfaMethod) {
        console.log(`Removing MFA requirement for session id: ${event.session?.id}`);
        api.user.setAppMetadata(`mfa_required_${event.session?.id}`, undefined);
      }
    };
    ```
  </Accordion>
</AccordionGroup>
