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

> アプリケーション向けに JWT で保護された認可リクエスト（JAR）を設定する方法を説明します。

# JWT で保護された認可リクエスト（JAR）の設定

export const AuthCodeBlock = ({filename, icon, language, highlight, children}) => {
  const [displayText, setDisplayText] = useState(children);
  const [copyText, setCopyText] = useState(children);
  const wrapperRef = React.useRef(null);
  useEffect(() => {
    let unsubscribe = null;
    function init() {
      if (!window.autorun || !window.rootStore) {
        return;
      }
      unsubscribe = window.autorun(() => {
        let processedChildrenForDisplay = children;
        let processedChildrenForCopy = children;
        for (const [key, value] of window.rootStore.variableStore.values.entries()) {
          const escapedKey = key.replaceAll(/[.*+?^${}()|[\]\\]/g, (String.raw)`\$&`);
          let displayValue = value;
          if (key === "{yourClientSecret}" && value !== "{yourClientSecret}") {
            displayValue = value.substring(0, 3) + "*****マスク済み*****";
          }
          processedChildrenForDisplay = processedChildrenForDisplay.replaceAll(new RegExp(escapedKey, "g"), displayValue);
          processedChildrenForCopy = processedChildrenForCopy.replaceAll(new RegExp(escapedKey, "g"), value);
        }
        setDisplayText(processedChildrenForDisplay);
        setCopyText(processedChildrenForCopy);
      });
    }
    if (window.rootStore) {
      init();
    } else {
      window.addEventListener("adu:storeReady", init);
    }
    return () => {
      window.removeEventListener("adu:storeReady", init);
      unsubscribe?.();
    };
  }, [children]);
  useEffect(() => {
    if (!wrapperRef.current) return;
    const originalWriteText = navigator.clipboard.writeText.bind(navigator.clipboard);
    let isOverriding = false;
    const handleClick = e => {
      const button = e.target.closest('[data-testid="copy-code-button"]');
      if (!button || !wrapperRef.current.contains(button)) return;
      isOverriding = true;
      navigator.clipboard.writeText = text => {
        if (isOverriding) {
          isOverriding = false;
          navigator.clipboard.writeText = originalWriteText;
          return originalWriteText(copyText);
        }
        return originalWriteText(text);
      };
      setTimeout(() => {
        if (isOverriding) {
          isOverriding = false;
          navigator.clipboard.writeText = originalWriteText;
        }
      }, 100);
    };
    const wrapper = wrapperRef.current;
    wrapper.addEventListener('click', handleClick, true);
    return () => {
      wrapper.removeEventListener('click', handleClick, true);
      if (navigator.clipboard.writeText !== originalWriteText) {
        navigator.clipboard.writeText = originalWriteText;
      }
    };
  }, [copyText]);
  return <div ref={wrapperRef}>
      <CodeBlock filename={filename} icon={icon} language={language} lines highlight={highlight}>
        {displayText}
      </CodeBlock>
    </div>;
};

export const codeExample1 = `POST https://{yourTenant}.auth0.com/api/v2/clients/{yourClientId}/credentials
  Authorization: Bearer <YOUR_ACCESS_TOKEN>
  Content-Type: application/json
  {
    "name": "JAR 向けの認証情報",
    "credential_type": "public_key",
    "pem": "[YOUR PEM FILE CONTENT]",
    "alg": "RS256"
  }`;

export const codeExample2 = `PATCH https://{yourTenant}.auth0.com/api/v2/clients/{yourClientId}
Authorization: Bearer <YOUR_ACCESS_TOKEN>
Content-Type: application/json
{
  "signed_request_object": {
    "credentials": [{"id": "[YOUR CREDENTIAL ID]"}]
  }
}`;

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  Highly Regulated Identity 機能を使用するには、Highly Regulated Identity アドオンを含む Enterprise Plan が必要です。詳しくは、[Auth0 Pricing](https://auth0.com/pricing/) を参照してください。
</Callout>

<Tooltip tip="JSON Web Token（JWT）: 2者間でクレームを安全に表現するために使用される、標準的な IDトークン 形式（多くの場合は アクセストークン 形式でもあります）。" cta="用語集を見る" href="/ja/docs/glossary?term=JWT">JWT</Tooltip>-Secured Authorization Requests (JAR) では、OAuth2 の認可リクエストパラメーターを単一の JWT リクエストパラメーターにまとめ、完全性を保護するために署名できます。

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

アプリケーションで JAR を使用するように設定する前に、[RSA キーペアを生成](/ja/docs/secure/application-credentials/generate-rsa-key-pair)する必要があります。

<Warning>
  認証情報の用途ごとに、個別のキーペアを生成してください。たとえば、JAR と Private Key JWT Authentication の両方に同じキーペアを再利用しないでください。
</Warning>

<div id="configure-jar-for-an-application">
  ## アプリケーション用のJARを設定する
</div>

<Tooltip tip="Auth0 Dashboard: Auth0のサービスを設定するための主要なプロダクト。" cta="用語集を表示" href="/ja/docs/glossary?term=Auth0+Dashboard">Auth0 Dashboard</Tooltip> と <Tooltip tip="Auth0 Dashboard: Auth0のサービスを設定するための主要なプロダクト。" cta="用語集を表示" href="/ja/docs/glossary?term=Management+API">Management API</Tooltip> を使用して、アプリケーション用のJARを設定できます。

<Tabs>
  <Tab title="Auth0 Dashboard">
    Auth0 Dashboard を使用して、事前に生成した RSA キーで JAR を使用するようアプリケーションを設定します。

    1. [Auth0 Dashboard > Applications](https://manage.auth0.com/#/applications) に移動します。
    2. JAR で使用するアプリケーションを選択します。
    3. **Application Settings** タブを選択します。
    4. **Authorization Requests** セクションで、**Require JWT-Secured Authorization Requests** を有効にします。
    5. 認証情報が割り当てられておらず、利用可能な認証情報がある場合は、既存の認証情報を割り当てるよう求められます。

           <Frame>
             <img src="https://mintcdn.com/translations/mMSz-RNYLuOm2GmQ/docs/images/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/e47068cc9e85c538f80476162f4314a3/Existing_Creds_-_English.png?fit=max&auto=format&n=mMSz-RNYLuOm2GmQ&q=85&s=563a22423de44f705848d08249cd327c" alt="Dashboard > Application > Settings > 既存の認証情報を割り当てる" data-og-width="792" width="792" data-og-height="688" height="688" data-path="docs/images/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/e47068cc9e85c538f80476162f4314a3/Existing_Creds_-_English.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/translations/mMSz-RNYLuOm2GmQ/docs/images/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/e47068cc9e85c538f80476162f4314a3/Existing_Creds_-_English.png?w=280&fit=max&auto=format&n=mMSz-RNYLuOm2GmQ&q=85&s=43bd8a48e25024ebc4e120dc583617bf 280w, https://mintcdn.com/translations/mMSz-RNYLuOm2GmQ/docs/images/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/e47068cc9e85c538f80476162f4314a3/Existing_Creds_-_English.png?w=560&fit=max&auto=format&n=mMSz-RNYLuOm2GmQ&q=85&s=80d27bf6d7bded96c2ca9b145ea3d039 560w, https://mintcdn.com/translations/mMSz-RNYLuOm2GmQ/docs/images/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/e47068cc9e85c538f80476162f4314a3/Existing_Creds_-_English.png?w=840&fit=max&auto=format&n=mMSz-RNYLuOm2GmQ&q=85&s=02bb47a10e6f61d023daf18f249985d0 840w, https://mintcdn.com/translations/mMSz-RNYLuOm2GmQ/docs/images/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/e47068cc9e85c538f80476162f4314a3/Existing_Creds_-_English.png?w=1100&fit=max&auto=format&n=mMSz-RNYLuOm2GmQ&q=85&s=caf70b98741e84fc03b0b97da058ce7b 1100w, https://mintcdn.com/translations/mMSz-RNYLuOm2GmQ/docs/images/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/e47068cc9e85c538f80476162f4314a3/Existing_Creds_-_English.png?w=1650&fit=max&auto=format&n=mMSz-RNYLuOm2GmQ&q=85&s=c924bf2bb2cadfbeb6d9ed56c855b9f3 1650w, https://mintcdn.com/translations/mMSz-RNYLuOm2GmQ/docs/images/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/e47068cc9e85c538f80476162f4314a3/Existing_Creds_-_English.png?w=2500&fit=max&auto=format&n=mMSz-RNYLuOm2GmQ&q=85&s=2be02e7ff6ac45e2f50c3bb0aa976fe8 2500w" />
           </Frame>
    6. 新しい認証情報を割り当てることもできます。

           <Frame>
             <img src="https://mintcdn.com/translations/c0RQ9V0YAcT0-8l5/docs/images/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/b85fd39fea7330a31496f51347767ae7/New_Creds_-_EN.png?fit=max&auto=format&n=c0RQ9V0YAcT0-8l5&q=85&s=aefb9bfd7421e2509f95f3bd8a334078" alt="Auth0 Dashboard > Applications > Settings > 新しい認証情報を割り当てる" data-og-width="702" width="702" data-og-height="366" height="366" data-path="docs/images/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/b85fd39fea7330a31496f51347767ae7/New_Creds_-_EN.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/translations/c0RQ9V0YAcT0-8l5/docs/images/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/b85fd39fea7330a31496f51347767ae7/New_Creds_-_EN.png?w=280&fit=max&auto=format&n=c0RQ9V0YAcT0-8l5&q=85&s=840b171f616c5ffa3e6a5516c4a8b582 280w, https://mintcdn.com/translations/c0RQ9V0YAcT0-8l5/docs/images/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/b85fd39fea7330a31496f51347767ae7/New_Creds_-_EN.png?w=560&fit=max&auto=format&n=c0RQ9V0YAcT0-8l5&q=85&s=f399f3a4a327b5e268ae8dc0665ac273 560w, https://mintcdn.com/translations/c0RQ9V0YAcT0-8l5/docs/images/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/b85fd39fea7330a31496f51347767ae7/New_Creds_-_EN.png?w=840&fit=max&auto=format&n=c0RQ9V0YAcT0-8l5&q=85&s=77c086b91ce428508aebd23d042e8d9a 840w, https://mintcdn.com/translations/c0RQ9V0YAcT0-8l5/docs/images/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/b85fd39fea7330a31496f51347767ae7/New_Creds_-_EN.png?w=1100&fit=max&auto=format&n=c0RQ9V0YAcT0-8l5&q=85&s=aca496b345ddb1e254cb2621bf520627 1100w, https://mintcdn.com/translations/c0RQ9V0YAcT0-8l5/docs/images/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/b85fd39fea7330a31496f51347767ae7/New_Creds_-_EN.png?w=1650&fit=max&auto=format&n=c0RQ9V0YAcT0-8l5&q=85&s=0a2ac8150e19326e2789fbde8ae1b075 1650w, https://mintcdn.com/translations/c0RQ9V0YAcT0-8l5/docs/images/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/b85fd39fea7330a31496f51347767ae7/New_Creds_-_EN.png?w=2500&fit=max&auto=format&n=c0RQ9V0YAcT0-8l5&q=85&s=20347b474ba2c2db11fbf53fb5115937 2500w" />
           </Frame>
    7. 事前に生成した RSA キーペアをアップロードして、新しい認証情報を追加し、割り当てます。求められたら、次の内容を入力します。

       * **Name**: 認証情報を識別するための名前
       * **Public Key**: PEM 形式の X.509 証明書の公開鍵
       * **Algorithm**: JAR の署名アルゴリズムを選択します
       * **Expiration Date**: 認証情報の有効期限を設定します
  </Tab>

  <Tab title="Management API">
    [Management API](https://auth0.com/docs/api/management/v2) を使用して、`signed_request_object` クライアント設定プロパティでアプリケーションの JAR を設定します。このオブジェクトプロパティには、次のフィールドが含まれます。

    * `required`: `/authorize` および `/oauth/par` へのすべての認可リクエストで JAR を必須にします。詳細は、[Authorization Code Flow with JWT-Secured Authorization Requests](/ja/docs/get-started/authentication-and-authorization-flow/authorization-code-flow/authorization-code-flow-with-jar) を参照してください。
    * `credentials`: 署名の検証に使用する認証情報 ID の配列です。

    <Callout icon="file-lines" color="#0EA5E9" iconType="regular">
      credentials パラメーターは、Private Key JWT パラメーター `client_authentication_methods.private_key_jwt.credentials` と同様の動作をし、新しいアプリケーションの作成時に認証情報の作成をサポートします。詳細は、[Configure Private Key JWT](/ja/docs/get-started/applications/configure-private-key-jwt) を参照してください。
    </Callout>

    Management API を使用すると、新しいアプリケーションまたは既存のアプリケーションに対して JAR を設定できます。

    #### 新しいアプリケーションの JAR を設定する

    新しいアプリケーションを作成する際は、`signed_request_object` を含む POST リクエストを送信して JAR を設定します。この POST リクエストでは、対応するクライアント認証情報 (つまりキー PEM) も登録できます。

    ```json lines theme={null}
    POST https://{yourTenant}.auth0.com/api/v2/clients
    Authorization: Bearer <YOUR_ACCESS_TOKEN>
    Content-Type: application/json
    {
      "name": "My App using JAR",
      "signed_request_object": {
          "required": true,
    "credentials": [{
            "name": "My credential for JAR",
            "credential_type": "public_key",
            "pem": "[YOUR PEM FILE CONTENT]",
            "alg": "RS256"
    }]
      },
      "jwt_configuration": {
        "alg": "RS256"
      }
    }
    ```

    #### 既存のアプリケーションの JAR を設定する

    既存のアプリケーションを更新する場合は、まずクライアント認証情報を明示的に作成する必要があります。次の POST リクエストでは、PEM ファイルの内容を使用して JAR 用のクライアント認証情報を作成します。

    <AuthCodeBlock children={codeExample1} language="json" />

    <Callout icon="file-lines" color="#0EA5E9" iconType="regular">
      改行が適切に JSON エンコードされ、追加の書式設定が含まれていないことを確認してください。
    </Callout>

    次に、クライアント認証情報を `signed_request_object` クライアント設定に割り当てます。次の PATCH リクエストでは、クライアント認証情報を `signed_request_object` に関連付けます。

    <AuthCodeBlock children={codeExample2} language="json" />
  </Tab>
</Tabs>

<div id="learn-more">
  ## 詳しく見る
</div>

* [JWT で保護された認可リクエスト (JAR) を使用する Authorization Code Flow](/ja/docs/get-started/authentication-and-authorization-flow/authorization-code-flow/authorization-code-flow-with-jar)
