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

# Auth0 データベース接続の柔軟なパスワードポリシーを設定する

> 柔軟なパスワードポリシーを使用して、Auth0 のデータベース接続におけるパスワードの強度と構成に関するルールを定義します。

export const ReleaseStageNotice = ({feature, stage, plans, contact, terms}) => {
  const stageTextMap = {
    "beta": "ベータ",
    "ea": "早期アクセス"
  };
  const stageText = stageTextMap[stage] || "製品リリース段階";
  const prsLink = "/docs/troubleshoot/product-lifecycle/product-release-stages";
  const linkify = (text, url) => {
    return <a href={url} target="_blank" rel="noreferrer" class="link">{text}</a>;
  };
  const includeDetails = (plans, contact, terms) => {
    const hasDetails = terms || plans || contact;
    if (!hasDetails) return null;
    return <span data-as="p">
            {plans && <>この機能は、{linkify(`${plans}プラン`, "https://auth0.com/pricing")}で利用できます。 </>}
            {contact && "参加するには、" + contact + " までお問い合わせください。 "}
            {terms && <>この機能を使用すると、Okta の{linkify("Master Subscription Agreement", "https://www.okta.com/legal")}に定める該当する無料トライアル条件に同意したものとみなされます。</>}
        </span>;
  };
  return <Warning>
            <span data-as="p">
                <strong>{feature} 機能は現在、{linkify(stageText, prsLink)}です。</strong>
            </span>

            {includeDetails(plans, contact, terms)}
        </Warning>;
};

<ReleaseStageNotice feature="柔軟なパスワードポリシー" stage="ea" terms="true" />

柔軟なパスワードポリシーは、[従来のパスワードポリシー](/ja/docs/authenticate/database-connections/password-options)に代わり、よりきめ細かな制御と設定オプションを提供します。

| ポリシー       | 従来の動作                                                            | 柔軟なパスワードポリシーの動作                                                               |
| ---------- | ---------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| パスワード強度    | 複雑さを 5 段階のプリセットレベルから選択します。<br /><br />最大長を超えるパスワードは自動的に切り捨てられます。 | 複雑さに関するすべての要件を個別にカスタマイズできます。<br /><br />最大長を超えるパスワードの扱い (切り捨てまたはエラー) を選択できます。 |
| パスワード履歴    | ユーザーが再利用できない過去のパスワード数を最大 24 件まで設定できます。                           | 同等の機能を提供します。                                                                  |
| パスワード辞書    | よく使われる 10,000 語を含む組み込み辞書を 1 つ使用します。                              | よく使われる 10,000 語または 100,000 語を含む 2 つの組み込み辞書から選択できます。                           |
| 個人データのブロック | 固定されたユーザー データ フィールドのセットをブロックします。                                 | ブロックするフィールドを最大 12 個まで自由にカスタマイズできます。                                           |

また、データベース接続向け Management API の構成スキーマでは、柔軟なパスワードポリシーにより、従来のパスワードポリシーの `options` オブジェクトや属性も、単一の設定可能な `options.password_options` オブジェクトに置き換えられます。

<div id="prerequisites">
  ## 前提条件
</div>

柔軟なパスワードポリシー を使用するには、次の要件を満たしている必要があります。

* Auth0 のユーザーストア (`"strategy": "auth0"`) を使用するデータベース接続を使用している必要があります。

* テナントで Universal Login を使用している必要があります。

* テナントにカスタムのパスワードリセット画面が設定されていない必要があります。

* Management API を使用する場合、アクセストークンには `read:connections` および `update:connections` スコープが必要です。これらのスコープがないと、それぞれデータベース接続の設定を取得または変更できません。

<div id="enable-the-flexible-password-policy">
  ## 柔軟なパスワードポリシーを有効にする
</div>

Auth0 Dashboard または Management API を使用して、柔軟なパスワードポリシーを有効化できます。

<Tabs>
  <Tab title="Auth0 Dashboard">
    Auth0 Dashboard で Flexible Password Policy を有効にするには、次の手順に従います。

    1. [Auth0 Dashboard > Authentication > Database](https://manage.auth0.com/#/connections/database) に移動し、編集する接続の名前を選択します。

    2. **Authentication Methods** タブを選択します。次に、**Password** セクションで **Configure** を選択して **Password** パネルを開きます。

    3. 上部の Flexible Password Policy バナーで **Activate** を選択し、続けて **Confirm** を選択します。

    これにより、データベース接続の既存のパスワードポリシーがレガシー構成から Flexible Password Policy 構成に変換され、**Authentication Methods** タブに戻ります。

    同じ **Authentication Methods > Password > Configure** パネルに、Flexible Password Policy の設定オプションが **Policy**、**Composition**、**Security** の 3 つのセクションに表示されます。

    <AccordionGroup>
      <Accordion title="Policy の設定">
        **Policy** セクションには、次の設定があります。

        * **Password for login**: ユーザーによるパスワードでのログインを許可またはブロックします。

        * **Password on signup**: ユーザーによるパスワードを使用したサインアップを許可またはブロックします。

        * **Self-service change password**: ユーザー自身によるパスワード変更を許可またはブロックします。

        * **Support users without a password**: Management API と Authentication API を使用して、パスワードなしでユーザーを作成できるようにするかどうかを切り替えます。
      </Accordion>

      <Accordion title="Composition の設定">
        **Composition** セクションには、次の設定があります。

        * **Minimum password length**: パスワードの最小文字数を入力します。

        * **Additional composition rules**

          * **Required password options**: 少なくとも 1 つの大文字、少なくとも 1 つの小文字、少なくとも 1 つの数字、少なくとも 1 つの特殊文字、または前述の 4 種類の文字種のうち少なくとも 3 種類を必須にします。

          * **Block three or more sequential characters**: ABC や 321 のように、3 文字以上連続する文字をブロックします

          * **Block three or more identical characters in a row**: 000 のように、同じ文字が 3 文字以上連続するものをブロックします

          * **Maximum password length exceeded**: 72 バイトを超えるパスワードについては、**Truncate password** (長いパスワードを許可するが、最初の 72 バイトのみを暗号化) または **Show error** (72 バイトを超えるパスワードを拒否) のいずれかを選択します。
      </Accordion>

      <Accordion title="Security の設定">
        **Security** セクションには、次の設定があります。

        * **Password history**: パスワードの再利用を防止します。

          * **Password history size**: ユーザーが再利用できない過去のパスワード数を選択します。

        * **Password dictionary**: 指定した辞書や、追加した辞書エントリに含まれるパスワードをユーザーが使用できないようにします。

          * **Default dictionary**: [10,000 common words](https://github.com/danielmiessler/SecLists/blob/master/Passwords/Common-Credentials/10k-most-common.txt) または [100,000 common words](https://github.com/danielmiessler/SecLists/blob/master/Passwords/Common-Credentials/100k-most-used-passwords-NCSC.txt) の辞書から選択します。

          * **Additional dictionary entries**: 追加で禁止するパスワードを 1 行に 1 つずつ入力します。

        * **Block profile data in passwords**: ユーザーのプロフィールデータを含むパスワードを設定できないようにします。

          * **Select profile fields to block**: ブロックする 8 つの一般的なデフォルトフィールドから選択します。

          * **Additional profile fields to block**: ブロックする追加のプロフィールフィールドを入力します。
      </Accordion>
    </AccordionGroup>

    これらの設定を変更したら、**Save** をクリックします。
  </Tab>

  <Tab title="Management API">
    データベース接続の設定では、`options` オブジェクトにパスワードポリシー設定が含まれます。Flexible Password Policy では、`options` 内の従来のパスワードオブジェクトや属性が、より詳細な設定を行える単一のオブジェクト (`options.password_options`) に置き換えられます。

    Management API を使用して Flexible Password Policy を有効にするには、次の手順に従います。

    <Steps>
      <Step title="現在のデータベース接続設定を取得する">
        まず、[Get a connection endpoint](https://auth0.com/docs/api/management/v2/connections/get-connections-by-id) を使用して、データベース接続の現在の設定を取得します。

        レスポンスに含まれる設定全体を保存してください。レスポンスボディのスキーマは、エンドポイントのドキュメントで確認できます。
      </Step>

      <Step title="従来の設定を Flexible Password Policy の設定に置き換える">
        設定の `options` オブジェクトから、次の従来のパスワードオブジェクトと値を削除し、続けて必要な Flexible Password Policy の設定を含む単一の `password_options` オブジェクトを追加します。

        | 従来の `options` 属性              | Flexible Password Policy の `options` 属性 |
        | ----------------------------- | --------------------------------------- |
        | `password_complexity_options` | `password_options.complexity`           |
        | `password_history`            | `password_options.history`              |
        | `password_no_personal_info`   | `password_options.profile_data`         |
        | `password_dictionary`         | `password_options.dictionary`           |
        | `passwordPolicy`              | 削除                                      |

        例として、次の 2 つの `options` パスワード設定は同等です。

        <Columns cols={2}>
          <div>
            ```json 従来のパスワードポリシーの例 theme={null}
            "password_history": {
                "enable": true,
                "size": 5
            },
            "password_dictionary": {
                "enable": true,
                "dictionary": [
                    "badPassword",
                    "reallyBadPassword"
                ]
            }
            ```
          </div>

          <div>
            ```json Flexible Password Policy の例 theme={null}
            "password_options": {
                "history": {
                    "active": true,
                    "size": 5
                },
                "dictionary": {
                    "active": true,
                    "default": "en_10k",
                    "custom": [
                        "badPassword",
                        "reallyBadPassword"
                    ]
                }
            }
            ```
          </div>
        </Columns>

        `password_options` オブジェクトの完全なスキーマは API リファレンスで確認できます (たとえば、[Update a connection endpoint](https://auth0.com/docs/api/management/v2/connections/patch-connections-by-id) の body parameters) 。
      </Step>

      <Step title="必要に応じて他のパスワード設定を更新する">
        `password_options` オブジェクト外のその他のパスワード属性は変更されませんが、Auth0 Dashboard の Flexible Password Policy 設定には表示されます。

        | Management API の `options` 属性                     | Auth0 Dashboard の設定        |
        | ------------------------------------------------- | -------------------------- |
        | `authentication_methods.password.enabled`         | Policy > ログイン用パスワード        |
        | `authentication_methods.password.signup_behavior` | Policy > サインアップ時のパスワード     |
        | `authentication_methods.password.api_behavior`    | Policy > パスワードなしのユーザーをサポート |
        | `disable_self_service_change_password`            | Policy > セルフサービスによるパスワード変更 |

        必要に応じて、これらの属性を更新して設定を変更できます。
      </Step>

      <Step title="データベース接続を更新する">
        [Update a connection endpoint](https://auth0.com/docs/api/management/v2/connections/patch-connections-by-id) を使用して、データベース接続を更新します。

        <Warning>
          このエンドポイントでは、送信した設定で既存の設定全体が上書きされます。そのため、データベース接続の他の設定を保持するには、変更後のオブジェクト全体を `PATCH` リクエストに含めてください。
        </Warning>
      </Step>
    </Steps>

    更新後は、[Get a connection endpoint](https://auth0.com/docs/api/management/v2/connections/get-connections-by-id) を使用して再度データベース接続の設定を取得することで確認できます。レスポンスに `options.password_options` オブジェクトが含まれていれば、そのデータベース接続では Flexible Password Policy が有効になっています。
  </Tab>
</Tabs>

<div id="revert-to-the-legacy-password-policies">
  ## 従来のパスワードポリシーに戻す
</div>

従来のパスワードポリシーに戻すには、Management API を使用します。

上記と同じ手順で、データベース接続を元の `options` に更新し、`password_options` オブジェクト全体を削除します。
