> ## 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.

> OpenID FAPI Certification Tests に合格するための Auth0 の設定方法を学びます。

# OpenID FAPI Certification Tests に合格するための Auth0 の設定

このセクションでは、[OpenID FAPI Conformance Tests](https://openid.net/certification/certification-fapi_op_testing/) を使用してソリューションをテストする場合の、クライアント設定に関するヒントを紹介します。

<Tooltip tip="OpenID: アプリケーションがログイン情報を収集・保存することなく、ユーザーの本人確認を行えるようにする認証のオープンスタンダード。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=OpenID">OpenID</Tooltip> FAPI Conformance Tests に合格するには、まず次の設定を行います。

* `compliance_level` プロパティを、目的のプロファイル (`fapi1_adv_pkj_par`、`fapi1_adv_mtls_par`、`fapi2_sp_pkj_mtls`、`fapi2_sp_mtls_mtls` のいずれか) に設定します
* [mTLS を設定](/docs/ja-jp/get-started/applications/configure-mtls) ([mTLS aliases](/docs/ja-jp/get-started/applications/configure-mtls/configure-mtls-for-a-tenant#enable-mtls-aliases) を含む) するか、[Private Key JWT を設定](/docs/ja-jp/get-started/applications/configure-private-key-jwt)します
* [mTLS Token Binding](/docs/ja-jp/get-started/applications/configure-mtls/configure-mtls-for-a-client#enable-token-binding) を設定します
* [Pushed Authorization Requests](/docs/ja-jp/get-started/applications/configure-par) を設定します
* テストに使用するすべてのクライアントで、`oidc_conformant` プロパティが `true` に設定されていることを確認します。これは、Auth0 Dashboard で作成されたクライアントのデフォルト値です。

次に、以下の手順に従って OpenID FAPI Conformance Tests の設定を完了してください。

* [Auth0 がユーザーに同意を求めるようにする](#ensure-auth0-prompts-users-for-consent)
* [テナントでサポートされる ACR クレーム を設定する](#configure-supported-acr-claims-for-the-tenant)
* [JWKS エンドポイント から alg プロパティを削除する](#remove-the-alg-property-from-jwks-endpoint)
* [scope と redirect\_uri を必須にする Action を追加する](#add-action-to-require-scope-and-redirect-uri)
* [(FAPI2 プロファイルのみ) レスポンスに `iss` クレーム が含まれるようにする](#fapi2-profiles-only-ensure-iss-claim-is-returned-in-responses)

<div id="ensure-auth0-prompts-users-for-consent">
  ### Auth0 がユーザーに同意を求めるようにする
</div>

Auth0 がユーザーに同意を求めるよう設定されていることを確認してください。クライアントがファーストパーティ アプリとして設定されており、<Tooltip tip="Resource Server: 保護されたリソースをホストするサーバー。リソース サーバーは、保護されたリソース リクエストを受け取り、応答します。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=Resource+Server">Resource Server</Tooltip> または API がファーストパーティ アプリでの同意のスキップをサポートしている場合は、この手順を省略できます。Auth0 がユーザーに同意を求めるようにするには、クライアントの `is_first_party` プロパティを `false` に設定します。

```bash lines theme={null}
curl --location --request PATCH 'https://{YOUR_DOMAIN}/api/v2/clients/YOUR_CLIENT_ID' \
  --header 'Authorization: Bearer {YOUR_MANAGEMENT_API_ACCESS_TOKEN}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "is_first_party": false  
}'
```

次に、接続をドメインレベルに引き上げます。

```bash lines theme={null}
curl --location --request PATCH 'https://{YOUR_DOMAIN}/api/v2/connections/YOUR_CONNECTION_ID' \
  --header 'Authorization: Bearer {YOUR_MANAGEMENT_API_ACCESS_TOKEN}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "is_domain_connection": true
}'
```

<div id="configure-supported-acr-claims-for-the-tenant">
  #### テナントでサポートするACRクレームを設定する
</div>

FAPIテストでは、必須のACR値として `urn:mace:incommon:iap:silver` が渡されます。必須のACR値を <Tooltip tip="クライアント自身のための認証情報であり、リソースへのアクセス用ではありません。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=ID+token">ID token</Tooltip> に含めるには、テナントでサポートするACR値の一覧に `urn:mace:incommon:iap:silver` を追加します。

```bash lines theme={null}
curl --location --request PATCH 'https://{YOUR_DOMAIN}/api/v2/tenants/settings' \
  --header 'Authorization: Bearer {YOUR_MANAGEMENT_API_ACCESS_TOKEN}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "acr_values_supported": ["urn:mace:incommon:iap:silver"]
}'
```

<div id="remove-the-alg-property-from-jwks-endpoint">
  #### JWKS エンドポイントから alg プロパティを削除する
</div>

キーを RS256 だけでなく複数のアルゴリズムで使用できるようにするには、`/.well-known/jwks.json` エンドポイントの出力からテナントの `alg` プロパティを削除します:

```bash lines theme={null}
curl --location --request PATCH 'https://{YOUR_DOMAIN}/api/v2/tenants/settings' \
  --header 'Authorization: Bearer {YOUR_MANAGEMENT_API_ACCESS_TOKEN}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "flags": {
        "remove_alg_from_jwks": true
    }
}'
```

<div id="add-action-to-require-scope-and-redirect_uri">
  #### `scope` と `redirect_uri` を必須にする Action を追加する
</div>

デフォルトでは、Auth0 は `scope` のないリクエストを許可し、`scope` が指定されていない場合は `openid` スコープを前提とします。Auth0 は `redirect_uri,` のないリクエストも許可しており、これは [Actions](/docs/ja-jp/customize/actions/explore-triggers/signup-and-login-triggers/login-trigger/redirect-with-actions) で設定できます。ただし、FAPI 適合性テストでは、Auth0 により厳格な制限が求められます。

次の Action を追加して、`scope` と `redirect_uri` に必要な制限を適用します。

```js lines theme={null}
exports.onExecutePostLogin = async (event, api) => {
  if (!event.request.body || !event.request.body.refresh_token) {
    // スコープを必須にする
    if (!event.request.query.scope) {
      api.access.deny('scope must be provided in the request');
    }
    // redirect_uri が存在しない場合のエラーメッセージを改善する
    if (!event.request.query.redirect_uri) {
      api.access.deny('redirect_uri must be provided in the request');
    }
  }
};
```

<div id="fapi2-profiles-only-ensure-iss-claim-is-returned-in-responses">
  #### &#x20;(FAPI2 プロファイルのみ) レスポンスで `iss` クレームを返すようにする
</div>

FAPI 2.0 Security Profile では、[RFC9207](https://www.rfc-editor.org/info/rfc9207) に従って、認可レスポンスで `iss` パラメーターを返すことが求められています。互換性上の理由から、Auth0 はデフォルトではこれを返しません。この動作を有効にするには、テナント設定の `authorization_response_iss_parameter_supported` プロパティを `true` に設定します。

```bash lines theme={null}
curl --location --request PATCH "https://{YOUR_DOMAIN}/api/v2/tenants/settings" \
  --header "Authorization: Bearer {YOUR_MANAGEMENT_API_ACCESS_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-raw '{
    "authorization_response_iss_parameter_supported": true
  }'
```

<div id="learn-more">
  ## 詳細情報
</div>

* [秘密鍵JWT認証の設定](/docs/ja-jp/get-started/applications/configure-private-key-jwt)
* [mTLS認証の設定](/docs/ja-jp/get-started/applications/configure-mtls)
