> ## Documentation Index
> Fetch the complete documentation index at: https://docs-dev-docs-event-stream-action-templates.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# JAR（JWT-Secured Authorization Request）を構成する

> アプリケーションにJWT-secured Authorization Requests（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) + "*****MASKED*****";
          }
          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": "My credentials for 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">
  ハイリーレギュレーテッドアイデンティティ機能を使用するには、エンタープライズプランとハイリーレギュレーテッドアイデンティティアドオンが必要です。詳細については、「[Auth0の価格設定](https://auth0.com/pricing/)」を参照してください。
</Callout>

<Tooltip data-tooltip-id="react-containers-DefinitionTooltip-3" href="/docs/ja-jp/glossary?term=json-web-token" tip="JSON Web Token（JWT）: 二者間のクレームを安全に表現するために使用される標準IDトークン形式（および多くの場合、アクセストークン形式）。" cta="用語集の表示">JWT</Tooltip>-secured Authorization Requests（JAR）を使用すると、OAuth2認可要求パラメーターが単一のJWT要求パラメーターにパッケージ化され、整合性保護のため署名されます。

## 前提条件

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

<Warning>
  資格情報の用途や目的ごとに個別のキーペアを生成する必要があります。たとえば、JAR認証と秘密鍵JWT認証の両方に同じキーペアを使用しないでください。
</Warning>

## アプリケーションに対するJARの構成

アプリケーションにJARを構成するには、<Tooltip data-tooltip-id="react-containers-DefinitionTooltip-0" href="/docs/ja-jp/glossary?term=auth0-dashboard" tip="Auth0 Dashboard: サービスを構成するためのAuth0の主製品。" cta="用語集の表示">Auth0 Dashboard</Tooltip>または<Tooltip data-tooltip-id="react-containers-DefinitionTooltip-0" href="/docs/ja-jp/glossary?term=management-api" tip="Management API: 顧客が管理タスクを実行できるようにするための製品。" cta="用語集の表示">Management API</Tooltip>を使用できます。

<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（JWT保護の認可要求をする）］** を有効にします。

    5. 資格情報が割り当てられておらず、利用可能な資格情報がある場合、既存の資格情報の割り当てを要求されます。

           <Frame>
             <img src="https://mintcdn.com/docs-dev-docs-event-stream-action-templates/9Vac8_IYDB9MGlmx/docs/images/ja-jp/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/ccaa87631feab761d7d23c45a24674bf/Existing_Creds_-_Japanese.png?fit=max&auto=format&n=9Vac8_IYDB9MGlmx&q=85&s=cbc2e47a04ce0d25923ea5da962b7c18" alt="Dashboard > Application > Settings > Assign Existing Credentials" data-og-width="792" width="792" data-og-height="690" height="690" data-path="docs/images/ja-jp/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/ccaa87631feab761d7d23c45a24674bf/Existing_Creds_-_Japanese.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-dev-docs-event-stream-action-templates/9Vac8_IYDB9MGlmx/docs/images/ja-jp/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/ccaa87631feab761d7d23c45a24674bf/Existing_Creds_-_Japanese.png?w=280&fit=max&auto=format&n=9Vac8_IYDB9MGlmx&q=85&s=1de5b4ac18ed790456f470d8c554cd40 280w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/9Vac8_IYDB9MGlmx/docs/images/ja-jp/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/ccaa87631feab761d7d23c45a24674bf/Existing_Creds_-_Japanese.png?w=560&fit=max&auto=format&n=9Vac8_IYDB9MGlmx&q=85&s=2f22045eaf17b4db0a30ff8edcbbbcf1 560w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/9Vac8_IYDB9MGlmx/docs/images/ja-jp/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/ccaa87631feab761d7d23c45a24674bf/Existing_Creds_-_Japanese.png?w=840&fit=max&auto=format&n=9Vac8_IYDB9MGlmx&q=85&s=1a6805f313f7f0d533a6a0aed531e784 840w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/9Vac8_IYDB9MGlmx/docs/images/ja-jp/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/ccaa87631feab761d7d23c45a24674bf/Existing_Creds_-_Japanese.png?w=1100&fit=max&auto=format&n=9Vac8_IYDB9MGlmx&q=85&s=8b778267edb99a4d2b4b4d51de4d10a5 1100w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/9Vac8_IYDB9MGlmx/docs/images/ja-jp/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/ccaa87631feab761d7d23c45a24674bf/Existing_Creds_-_Japanese.png?w=1650&fit=max&auto=format&n=9Vac8_IYDB9MGlmx&q=85&s=00f95a3c78ebf04ac15dbdc4ad1465ed 1650w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/9Vac8_IYDB9MGlmx/docs/images/ja-jp/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/ccaa87631feab761d7d23c45a24674bf/Existing_Creds_-_Japanese.png?w=2500&fit=max&auto=format&n=9Vac8_IYDB9MGlmx&q=85&s=c1e22f86facde151685e52a608164340 2500w" />
           </Frame>

    6. 新しい資格情報を割り当てることもできます。

           <Frame>
             <img src="https://mintcdn.com/docs-dev-docs-event-stream-action-templates/ZqABYvyPOuGZRvBz/docs/images/ja-jp/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/f5ec2e430514faef17fb06c6735a0c61/New_Creds_-_JP.png?fit=max&auto=format&n=ZqABYvyPOuGZRvBz&q=85&s=eec291fd600ee6645d068309d3ef17a5" alt="Auth0 Dashboard > Applications > Settings > Assign New Credentials" data-og-width="702" width="702" data-og-height="366" height="366" data-path="docs/images/ja-jp/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/f5ec2e430514faef17fb06c6735a0c61/New_Creds_-_JP.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-dev-docs-event-stream-action-templates/ZqABYvyPOuGZRvBz/docs/images/ja-jp/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/f5ec2e430514faef17fb06c6735a0c61/New_Creds_-_JP.png?w=280&fit=max&auto=format&n=ZqABYvyPOuGZRvBz&q=85&s=1969c244de514aeab29d9e71dc4daebc 280w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/ZqABYvyPOuGZRvBz/docs/images/ja-jp/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/f5ec2e430514faef17fb06c6735a0c61/New_Creds_-_JP.png?w=560&fit=max&auto=format&n=ZqABYvyPOuGZRvBz&q=85&s=a68db2dc34551d4ac6f8bfde00ce04a4 560w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/ZqABYvyPOuGZRvBz/docs/images/ja-jp/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/f5ec2e430514faef17fb06c6735a0c61/New_Creds_-_JP.png?w=840&fit=max&auto=format&n=ZqABYvyPOuGZRvBz&q=85&s=a90d340076b2e79abafbcf44a568c245 840w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/ZqABYvyPOuGZRvBz/docs/images/ja-jp/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/f5ec2e430514faef17fb06c6735a0c61/New_Creds_-_JP.png?w=1100&fit=max&auto=format&n=ZqABYvyPOuGZRvBz&q=85&s=378cf93fb6231a2ba2a4b4c734f0f2b5 1100w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/ZqABYvyPOuGZRvBz/docs/images/ja-jp/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/f5ec2e430514faef17fb06c6735a0c61/New_Creds_-_JP.png?w=1650&fit=max&auto=format&n=ZqABYvyPOuGZRvBz&q=85&s=8bb1f9c6262bc4583b308aa965377deb 1650w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/ZqABYvyPOuGZRvBz/docs/images/ja-jp/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/f5ec2e430514faef17fb06c6735a0c61/New_Creds_-_JP.png?w=2500&fit=max&auto=format&n=ZqABYvyPOuGZRvBz&q=85&s=5832945e3b03932bdfd2cbfe081b79cb 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`：JARを使用するために、すべての認可要求を`/authorize`と`/oauth/par`に送ります。詳細については、「[JWT保護の認可要求を使用した認可コードフロー](/docs/ja-jp/get-started/authentication-and-authorization-flow/authorization-code-flow/authorization-code-flow-with-jar)」と「[PARとJARを使用した認可コードフロー](/docs/ja-jp/get-started/authentication-and-authorization-flow/authorization-code-flow/authorization-code-flow-with-par-and-jar)」をお読みください。
    * `credentials`：署名の検証に使用される資格情報IDの配列。

    <Callout icon="file-lines" color="#0EA5E9" iconType="regular">
      資格情報パラメーターは、新しいアプリケーションの作成時に資格情報作成をサポートする秘密鍵JWTパラメーター、`client_authentication_methods.private_key_jwt.credentials`と同じように動作します。詳細については、「[秘密鍵JWTを構成する](/docs/ja-jp/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要求で、JARに対するクライアント資格情報を作成するためのPEMファイルコンテンツを使用します：

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

## もっと詳しく

* [JWT-Secured Authorization Requests（JAR）を使った認可コードフロー](/docs/ja-jp/get-started/authentication-and-authorization-flow/authorization-code-flow/authorization-code-flow-with-jar)
* [PARとJARを使った認可コードフロー](/docs/ja-jp/get-started/authentication-and-authorization-flow/authorization-code-flow/authorization-code-flow-with-par-and-jar)
