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

> Auth0 AD/LDAP Connector と Auth0 の間で相互 TLS を構成するには、Connector がすべての送信接続で提示するクライアント証明書を発行します。

# クライアント証明書を使用した AD/LDAP Connector 認証の構成

AD/LDAP Connector では、ユーザーが自分のマシンやデバイスにインストールされた証明書を使って認証することもできます。

<h2 id="enable-client-certificates">
  クライアント証明書を有効にする
</h2>

1. [Auth0 Dashboard > Authentication > Enterprise > Active Directory/LDAP](https://manage.auth0.com/#/connections/enterprise/ad) に移動し、設定する接続を選択します。
2. 設定で **Use client SSL certificate authentication** オプションをオンにします。
3. **IP Ranges** フィールドに IP アドレス範囲を入力します。指定した IP アドレス範囲からアクセスするユーザーにのみ、クライアント証明書を使用した認証が求められます。その他の IP アドレス範囲からアクセスするユーザーには、ユーザー名とパスワードのログインフォームが表示されます。

<h2 id="configure-certificates">
  証明書を設定する
</h2>

Auth0 で AD/LDAP 接続を設定したら、次に AD/LDAP Connector で証明書を設定する必要があります。クライアント証明書をサポートするには、次のものが必要です。

* Front Facing URL 用の SSL 証明書。エンドユーザーと Connector の間の通信は HTTPS 経由で行う必要があるためです。
* 1 つ以上の CA 証明書。
* クライアント証明書を使用して認証する各ユーザーごとに、CA によって署名されたクライアント証明書。

1. AD/LDAP Connector に証明書をアップロードする前に、X.509 証明書を Base64 形式に変換します。Windows Server では Base64 または Certutil を使用してください。詳しくは、Base64decode の [Base64 Decode](https://www.base64decode.org/) または Microsoft ドキュメントの [Certutil.exe](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/certutil#BKMK_encode) を参照してください。
2. SSL 証明書と CA 証明書を AD/LDAP Connector にアップロードします。

   <Frame>
     <img src="https://mintlify.s3.us-west-1.amazonaws.com/auth0-actions-modules-ga/docs/images/cdy7uua7fh8z/2zRux90ZHATIBFWyHlodue/c426e5a475ff528a467db6409980de12/connector-client-cert-config.png" alt="クライアント証明書を使用した AD/LDAP Connector 認証の構成設定画面" />
   </Frame>
3. テストするには、Windows SDK に含まれる Windows の **makecert.exe** を使用して、自己署名 CA とクライアント証明書を生成します。

   ```bash lines theme={null}
   SET ClientCertificateName=jon
       SET RootCertificateName=FabrikamRootCA
       "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\makecert.exe" -sky exchange -r -n "CN=%RootCertificateName%" -pe -a sha1 -len 2048 -ss My "%RootCertificateName%.cer"
       "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\makecert.exe" -n "CN=%ClientCertificateName%" -pe -sky exchange -m 96 -ss My -in "%RootCertificateName%" -is my -a sha1
   ```

   クライアント証明書のサブジェクトは、`CN=AD_USERNAME` の形式であることが重要です。たとえば `CN=jon` です。

アプリケーションで、ユーザーが AD/LDAP 接続を使用してサインインフローを開始すると、次のようになります。

```js lines theme={null}
auth.signin({
       popup: true,
       connection: 'FabrikamAD',
       scope: 'openid name email'
     }, onLoginSuccess, onLoginFailed);
```

ユーザーのIPアドレスが設定済みのIP範囲内にある場合、クライアント証明書で認証するよう求められます：

<Frame>
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/auth0-actions-modules-ga/docs/images/cdy7uua7fh8z/1loz5lrd2NkHs2gKgbIJKF/11a373d520eaae08c20055cb68613972/connector-client-cert-choose.png" alt="クライアント証明書を使用した AD/LDAP Connector 認証の構成 - クライアント証明書の選択" />
</Frame>

証明書を選択すると、AD/LDAP Connectorがその証明書を検証し、ユーザーはログインします：

<Frame>
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/auth0-actions-modules-ga/docs/images/cdy7uua7fh8z/2Lr78NWYfzD3Hw3JIDPQmb/3790acd68fa283ca79c1263f97fa29c4/connector-client-cert-loggedin.png" alt="クライアント証明書を使用した AD/LDAP Connector 認証の構成 - ログイン済みユーザー" />
</Frame>
