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

# セッション委譲を設定する

> 委譲されたセッションをリクエストして受け入れるために必要なクライアント設定の方法を説明します。

export const ReleaseStageNotice = ({feature, stage, plans, contact, terms}) => {
  const stageTextMap = {
    "beta": "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>;
};

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

<ReleaseStageNotice feature="セッション委譲" stage="ea" plans="B2C Professional, B2B Professional, and Enterprise" terms="true" />

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  このページでは設定のみを扱います。以下の両方のアプリケーションを設定した後、セキュリティモデルとリクエスト/レスポンスの詳細については、[セッション委譲 を実装する](/docs/ja-jp/authenticate/single-sign-on/session-delegation/implement-session-delegation)を参照してください。
</Callout>

<div id="configure-your-applications">
  ## アプリケーションを設定する
</div>

<div id="configure-the-requesting-application">
  ### 要求元アプリケーションを構成する
</div>

Session Transfer Token を取得するためにカスタムトークン交換を呼び出すアプリケーションでは、カスタムトークン交換を有効にし、Session Transfer Token を作成できるように設定する必要があります。

```json lines theme={null}
{
  "token_exchange": {
    "allow_any_profile_of_type": ["custom_authentication"]
  },
  "session_transfer": {
    "can_create_session_transfer_token": true,
    "enforce_cascade_revocation": true
  }
}
```

export const codeExample1 = `curl --request PATCH \
  --url 'https://{yourDomain}/api/v2/clients/{yourClientId}' \
  --header 'authorization: Bearer {yourMgmtApiAccessToken}' \
  --header 'content-type: application/json' \
  --data '{
  "token_exchange": {
    "allow_any_profile_of_type": ["custom_authentication"]
  },
  "session_transfer": {
    "can_create_session_transfer_token": true,
    "enforce_cascade_revocation": true
  }
}'`;

<AuthCodeBlock children={codeExample1} language="bash" filename="cURL" />

`can_create_session_transfer_token` 設定の詳細については、[Session Transfer Token の作成と管理](/docs/ja-jp/authenticate/single-sign-on/native-to-web/configure-implement-native-to-web#create-and-manage-session-transfer-tokens)を参照してください。

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  Session Transfer Token をリクエストするためにカスタムトークン交換を呼び出すアプリケーションは、Client Secret (または他の confidential client 向けの方法) で認証する confidential client である必要があります。標準のカスタムトークン交換リクエストとは異なり、Session Transfer Token をリクエストする場合は、`tokenEndpointAuthMethod: none` の public client オプションはサポートされていません。
</Callout>

<div id="configure-the-target-web-application">
  ### 対象の Web アプリケーションを設定する
</div>

Web アプリケーションで委任されたセッションの受け入れを明示的に opt in し、`/authorize` で Session Transfer Token をクエリパラメータとして受け入れる必要があります。

```json lines theme={null}
{
    "session_transfer": {
        "allowed_authentication_methods": ["cookie", "query"],
        "enforce_device_binding": "ip", // "none" または "asn" も指定可能
        "allow_refresh_token": false,
        "enforce_online_refresh_tokens": true,
        "delegation": {
           "allow_delegated_access": true,
           "enforce_device_binding": "ip" // 委譲で指定できる値はこれのみ
        }
    }
}
```

export const codeExample2 = `curl --request PATCH \
  --url 'https://{yourDomain}/api/v2/clients/{yourClientId}' \
  --header 'authorization: Bearer {yourMgmtApiAccessToken}' \
  --header 'content-type: application/json' \
  --data '{
    "session_transfer": {
        "allowed_authentication_methods": ["cookie", "query"],
        "enforce_device_binding": "ip",
        "allow_refresh_token": false,
        "enforce_online_refresh_tokens": true,
        "delegation": {
           "allow_delegated_access": true,
           "enforce_device_binding": "ip"
        }
    }
}'`;

<AuthCodeBlock children={codeExample2} language="bash" filename="cURL" />

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  セッション委譲 では Session Transfer Token を URL クエリパラメータとして渡すため、`allowed_authentication_methods` に `query` を含める必要があります。ネイティブからWebへのSSO で使用される Cookie ベースの転送は、ここでは適用されません。`delegation.enforce_device_binding` に指定できるのは `"ip"` のみで、委譲されたセッションには IP ベースのデバイスバインディングが自動的に適用されます。この設定はデフォルトで無効になっており、現時点では同等の Dashboard UI トグルはありません。Management API または infrastructure-as-code ツール (Terraform、Deploy CLI) で設定してください。

  actor を含む Session Transfer Token が、`allow_delegated_access` が有効になっていないクライアントに提示された場合、Auth0 はエラーを返しません。代わりにログインページを表示し、warning (`w`) テナントログを出力します。委譲されたセッションで予期せずログインプロンプトが表示される場合は、これを確認してください。
</Callout>

両方のアプリケーションを設定したら、リクエストの実行方法については [セッション委譲](/docs/ja-jp/authenticate/single-sign-on/session-delegation/implement-session-delegation) を、セッションの動作と監査ログについては [Delegated Session Behavior and Monitoring](/docs/ja-jp/authenticate/single-sign-on/session-delegation/session-delegation-behavior-and-monitoring) を参照してください。
