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

> エンタープライズ接続を使用して、SAML IDプロバイダーに接続する方法を学びます。

# アプリをSAML IDプロバイダーに接続する

export const AuthCodeGroup = ({children, dropdown}) => {
  const [processedChildren, setProcessedChildren] = useState(children);
  useEffect(() => {
    let unsubscribe = null;
    function init() {
      unsubscribe = window.autorun(() => {
        const processChildren = node => {
          if (typeof node === "string") {
            let processedNode = node;
            for (const [key, value] of window.rootStore.variableStore.values.entries()) {
              const escapedKey = key.replaceAll(/[.*+?^${}()|[\]\\]/g, (String.raw)`\$&`);
              processedNode = processedNode.replaceAll(new RegExp(escapedKey, "g"), value);
            }
            return processedNode;
          } else if (Array.isArray(node)) {
            return node.map(processChildren);
          } else if (node && node.props && node.props.children) {
            return {
              ...node,
              props: {
                ...node.props,
                children: processChildren(node.props.children)
              }
            };
          }
          return node;
        };
        setProcessedChildren(processChildren(children));
      });
    }
    if (window.rootStore) {
      init();
    } else {
      window.addEventListener("adu:storeReady", init);
    }
    return () => {
      window.removeEventListener("adu:storeReady", init);
      unsubscribe?.();
    };
  }, [children]);
  return <CodeGroup dropdown={dropdown}>{processedChildren}</CodeGroup>;
};

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

Auth0 では、<Tooltip tip="Security Assertion Markup Language（SAML）: パスワードなしで2者間の認証情報のやり取りを可能にする標準化されたプロトコル。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=SAML">SAML</Tooltip> <Tooltip tip="Security Assertion Markup Language（SAML）: パスワードなしで2者間の認証情報のやり取りを可能にする標準化されたプロトコル。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=Identity+Provider">IDプロバイダー</Tooltip> (IdP) 接続を作成できます。

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

開始する前に、以下を行ってください。

* [Auth0 にアプリケーションを登録する](/docs/ja-jp/get-started/auth0-overview/create-applications)。

  * 適切な **Application Type** を選択します。
  * **Allowed Callback URL** に **`{https://yourApp/callback}`** を追加します。
  * アプリケーションの [Grant Types](/docs/ja-jp/get-started/applications/update-grant-types) に適切なフローが含まれていることを確認します。
* このエンタープライズ接続の名前を決めます

  * Post-back URL (Assertion Consumer Service URL とも呼ばれます) は次のようになります：`https://{yourDomain}/login/callback?connection={yourConnectionName}`
  * Entity ID は次のようになります：`urn:auth0:{yourTenant}:{yourConnectionName}`

<div id="steps">
  ## 手順
</div>

アプリケーションを SAML IDプロバイダーに接続するには、次の手順を行います。

1. IdP で Post-back URL と Entity ID を入力します (手順については、[SAML Identity Provider Configuration Settings](/docs/ja-jp/authenticate/protocols/saml/saml-identity-provider-configuration-settings) を参照してください) 。
2. [IdP から署名証明書を取得し](#get-the-signing-certificate-from-the-idp)、[Base64 に変換します](#convert-signing-certificate-to-base64)。
3. [Auth0 でエンタープライズ接続を作成します](#create-an-enterprise-connection-in-auth0)。
4. [Auth0アプリケーションでエンタープライズ接続を有効にします](#enable-the-enterprise-connection-for-your-auth0-application)。
5. [マッピングを設定します](#set-up-mappings) (ほとんどの場合は不要です) 。
6. [接続をテストします](#test-the-connection)。

<div id="get-the-signing-certificate-from-the-idp">
  ## IdP から署名証明書を取得する
</div>

SAML Login では、Auth0 はサービスプロバイダーとして機能するため、SAML IdP から X.509 署名証明書 (PEM または CER 形式) を取得する必要があります。後で、この証明書を Auth0 にアップロードします。証明書の取得方法は環境によって異なるため、さらにサポートが必要な場合は、IdP のドキュメントを参照してください。

<div id="convert-signing-certificate-to-base64">
  ### 署名証明書をBase64形式に変換する
</div>

X.509署名証明書のアップロードには、<Tooltip tip="Management API: お客様が管理タスクを実行できるようにする製品。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=Management+API">Management API</Tooltip> または <Tooltip tip="Management API: お客様が管理タスクを実行できるようにする製品。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=Auth0+Dashboard">Auth0 Dashboard</Tooltip> を使用できます。Management API を使用する場合は、ファイルをBase64形式に変換する必要があります。これを行うには、[シンプルなオンラインツール](https://www.base64decode.org/) を使用するか、Bashで次のコマンドを実行します: `cat signing-cert.crt | base64`。

<div id="assertion-encryption">
  ## アサーションの暗号化
</div>

SAML アサーションが暗号化されている場合は、Auth0 が復号をどのように処理するかを指定するために、接続に対して[追加の値を設定する](/docs/ja-jp/authenticate/protocols/saml/saml-sso-integrations/algorithm-profiles)必要があります。

<div id="create-an-enterprise-connection-in-auth0">
  ## Auth0 でエンタープライズ接続を作成する
</div>

次に、Auth0 で SAML エンタープライズ接続を作成して設定し、X.509 署名証明書をアップロードする必要があります。この作業は、Auth0 Dashboard または Management API のいずれかを使用して実行できます。

<div id="create-an-enterprise-connection-using-the-dashboard">
  ### Auth0 Dashboard を使用してエンタープライズ接続を作成する
</div>

1. [Auth0 Dashboard > Authentication > Enterprise](https://manage.auth0.com/#/connections/enterprise) に移動し、**SAML** を見つけて `+` を選択します。

   <Frame>
     <img src="https://mintcdn.com/translations/eVsQcTnbClN-oB7d/docs/images/cdy7uua7fh8z/1fSTcrZpkgkPR64NnI1lr8/b3454e60a4463e99353603fd11a71983/Enterprise_Connections_-_EN.png?fit=max&auto=format&n=eVsQcTnbClN-oB7d&q=85&s=d70364390d8c16ca8efe20e3e1795db4" alt="Dashboard - Connections - Enterprise" width="600" height="561" data-path="docs/images/cdy7uua7fh8z/1fSTcrZpkgkPR64NnI1lr8/b3454e60a4463e99353603fd11a71983/Enterprise_Connections_-_EN.png" />
   </Frame>
2. 接続の詳細を入力し、**Create:** を選択します。

| Field                             | Description                                                                                                |
| --------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| **Connection name**               | 接続の論理識別子です。テナント内で一意である必要があり、IdP で Post-back URL と Entity ID を設定する際にも同じ名前を使用する必要があります。一度設定すると、この名前は変更できません。 |
| **Sign In URL**                   | SAML シングルログイン URL。                                                                                         |
| **X.509 Signing Certificate**     | この手順の前の段階で IdP から取得した署名証明書 (PEM または CER でエンコードされたもの) 。                                                     |
| **Enable Sign Out**               | 有効にすると、専用の Sign Out URL を設定できます。無効の場合は、デフォルトで Sign In URL が使用されます。                                         |
| **Sign Out URL** (optional)       | SAML シングルログアウト URL。                                                                                        |
| **User ID Attribute** (optional)  | Auth0 の `user_id` プロパティにマッピングされる SAML トークン内の属性。                                                            |
| **Debug Mode**                    | 有効にすると、認証プロセス中により詳細なログが出力されます。                                                                             |
| **Sign Request**                  | 有効にすると、SAML 認証リクエストに署名されます。 (SAML IdP がアサーションの署名を検証できるよう、対応する証明書を必ずダウンロードして提供してください。)                      |
| **Sign Request Algorithm**        | Auth0 が SAML アサーションの署名に使用するアルゴリズム。                                                                         |
| **Sign Request Digest Algorithm** | Auth0 が署名リクエストのダイジェストに使用するアルゴリズム。                                                                          |
| **Protocol Binding**              | IdP がサポートする HTTP バインディング。                                                                                  |
| **Request Template** (optional)   | SAML リクエストの形式を定義するテンプレート。                                                                                  |

<Frame>
  <img src="https://mintcdn.com/translations/c0RQ9V0YAcT0-8l5/docs/images/cdy7uua7fh8z/7hvlp8kjva9uFzm5nwsBTQ/4c9f4d01438a3dab6cfb19a5d61d3f13/SAML_Connection_2.png?fit=max&auto=format&n=c0RQ9V0YAcT0-8l5&q=85&s=d1866ce05cbdd547a28f883b5f6018f9" alt="Configure SAML Settings" width="736" height="1488" data-path="docs/images/cdy7uua7fh8z/7hvlp8kjva9uFzm5nwsBTQ/4c9f4d01438a3dab6cfb19a5d61d3f13/SAML_Connection_2.png" />
</Frame>

3\. **Provisioning** view で、Auth0 でユーザープロファイルを作成および更新する方法を設定します。

| Field                                          | Description                                                                                                                                                     |
| ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Sync user profile attributes at each login** | 有効にすると、Auth0 はユーザーがログインするたびにユーザープロファイルデータを自動的に同期し、接続元で行われた変更が Auth0 に自動的に反映されるようにします。                                                                           |
| **Sync user profiles using SCIM**              | 有効にすると、Auth0 は SCIM を使用してユーザープロファイルデータを同期できるようになります。詳細については、[Configure Inbound SCIM](/docs/ja-jp/authenticate/protocols/scim/configure-inbound-scim) を参照してください。 |

4. **Login Experience** view で、この接続を使用したユーザーのログイン方法を設定します。

| Field                              | Description                                                                                                                                                                    |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Home Realm Discovery**           | ユーザーのメールドメインを、指定された IDプロバイダー のドメインと比較します。詳細については、[Configure Identifier First Authentication](/docs/ja-jp/authenticate/login/auth0-universal-login/identifier-first) を参照してください。 |
| **Display connection button**      | このオプションでは、アプリケーションの接続ボタンをカスタマイズするための以下の選択肢が表示されます。                                                                                                                             |
| **Button display name** (Optional) | Universal Login のログインボタンをカスタマイズするためのテキストです。設定すると、ボタンには「Continue with \{Button display name}」と表示されます。                                                                           |
| **Button logo URL** (Optional)     | Universal Login のログインボタンをカスタマイズするための画像 URL です。設定すると、Universal Login のログインボタンに画像が 20px × 20px の正方形で表示されます。                                                                      |

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  Optional フィールドは Universal Login でのみ使用できます。Classic Login を使用しているお客様には、Add ボタン、Button display name、Button logo URL は表示されません。
</Callout>

5. 連携を完了するために必要な管理者権限がある場合は、**Continue** をクリックして、IdP の設定に必要なカスタムパラメーターを確認します。そうでない場合は、必要な設定を管理者が調整できるよう、表示された URL を管理者に共有してください。

<div id="create-an-enterprise-connection-using-the-management-api">
  ### Management API を使用してエンタープライズ接続を作成する
</div>

[Management API](https://auth0.com/docs/api/management/v2) を使用して SAML 接続を作成することもできます。その場合は、各 SAML 設定項目を手動で指定することも、設定値を含む SAML メタデータドキュメントを指定することもできます。

<div id="create-a-connection-using-specified-values">
  #### 指定した値を使用して接続を作成する
</div>

[Create a Connection endpoint](https://auth0.com/docs/api/management/v2#!/Connections/patch_connections_by_id) に `POST` リクエストを送信します。`MGMT_API_ACCESS_TOKEN`、`CONNECTION_NAME`、`SIGN_IN_ENDPOINT_URL`、`SIGN_OUT_ENDPOINT_URL`、および `BASE64_SIGNING_CERT` のプレースホルダー値は、それぞれ Management API の <Tooltip tip="Access Token: API にアクセスするために使用される、不透明な文字列または JWT 形式の認可資格情報。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=Access+Token">Access Token</Tooltip>、接続名、サインイン URL、サインアウト URL、Base64 エンコードされた署名証明書 (PEM または CER 形式) に必ず置き換えてください。

<AuthCodeGroup>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://{yourDomain}/api/v2/connections' \
    --header 'authorization: Bearer MGMT_API_ACCESS_TOKEN' \
    --header 'cache-control: no-cache' \
    --header 'content-type: application/json' \
    --data '{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "signInEndpoint": "SIGN_IN_ENDPOINT_URL", "signOutEndpoint": "SIGN_OUT_ENDPOINT_URL", "signatureAlgorithm": "rsa-sha256", "digestAlgorithm": "sha256", "fieldsMap": {}, "signingCert": "BASE64_SIGNING_CERT" } }'
  ```

  ```csharp C# theme={null}
  var client = new RestClient("https://{yourDomain}/api/v2/connections");
  var request = new RestRequest(Method.POST);
  request.AddHeader("content-type", "application/json");
  request.AddHeader("authorization", "Bearer MGMT_API_ACCESS_TOKEN");
  request.AddHeader("cache-control", "no-cache");
  request.AddParameter("application/json", "{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "signInEndpoint": "SIGN_IN_ENDPOINT_URL", "signOutEndpoint": "SIGN_OUT_ENDPOINT_URL", "signatureAlgorithm": "rsa-sha256", "digestAlgorithm": "sha256", "fieldsMap": {}, "signingCert": "BASE64_SIGNING_CERT" } }", ParameterType.RequestBody);
  IRestResponse response = client.Execute(request);
  ```

  ```go Go theme={null}
  package main

  import (
  	"fmt"
  	"strings"
  	"net/http"
  	"io/ioutil"
  )

  func main() {

  	url := "https://{yourDomain}/api/v2/connections"

  	payload := strings.NewReader("{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "signInEndpoint": "SIGN_IN_ENDPOINT_URL", "signOutEndpoint": "SIGN_OUT_ENDPOINT_URL", "signatureAlgorithm": "rsa-sha256", "digestAlgorithm": "sha256", "fieldsMap": {}, "signingCert": "BASE64_SIGNING_CERT" } }")

  	req, _ := http.NewRequest("POST", url, payload)

  	req.Header.Add("content-type", "application/json")
  	req.Header.Add("authorization", "Bearer MGMT_API_ACCESS_TOKEN")
  	req.Header.Add("cache-control", "no-cache")

  	res, _ := http.DefaultClient.Do(req)

  	defer res.Body.Close()
  	body, _ := ioutil.ReadAll(res.Body)

  	fmt.Println(res)
  	fmt.Println(string(body))

  }
  ```

  ```java Java theme={null}
  HttpResponse<String> response = Unirest.post("https://{yourDomain}/api/v2/connections")
    .header("content-type", "application/json")
    .header("authorization", "Bearer MGMT_API_ACCESS_TOKEN")
    .header("cache-control", "no-cache")
    .body("{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "signInEndpoint": "SIGN_IN_ENDPOINT_URL", "signOutEndpoint": "SIGN_OUT_ENDPOINT_URL", "signatureAlgorithm": "rsa-sha256", "digestAlgorithm": "sha256", "fieldsMap": {}, "signingCert": "BASE64_SIGNING_CERT" } }")
    .asString();
  ```

  ```javascript Node.JS theme={null}
  var axios = require("axios").default;

  var options = {
    method: 'POST',
    url: 'https://{yourDomain}/api/v2/connections',
    headers: {
      'content-type': 'application/json',
      authorization: 'Bearer MGMT_API_ACCESS_TOKEN',
      'cache-control': 'no-cache'
    },
    data: {
      strategy: 'samlp',
      name: 'CONNECTION_NAME',
      options: {
        signInEndpoint: 'SIGN_IN_ENDPOINT_URL',
        signOutEndpoint: 'SIGN_OUT_ENDPOINT_URL',
        signatureAlgorithm: 'rsa-sha256',
        digestAlgorithm: 'sha256',
        fieldsMap: {},
        signingCert: 'BASE64_SIGNING_CERT'
      }
    }
  };

  axios.request(options).then(function (response) {
    console.log(response.data);
  }).catch(function (error) {
    console.error(error);
  });
  ```

  ```php PHP theme={null}
  $curl = curl_init();

  curl_setopt_array($curl, [
    CURLOPT_URL => "https://{yourDomain}/api/v2/connections",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "signInEndpoint": "SIGN_IN_ENDPOINT_URL", "signOutEndpoint": "SIGN_OUT_ENDPOINT_URL", "signatureAlgorithm": "rsa-sha256", "digestAlgorithm": "sha256", "fieldsMap": {}, "signingCert": "BASE64_SIGNING_CERT" } }",
    CURLOPT_HTTPHEADER => [
      "authorization: Bearer MGMT_API_ACCESS_TOKEN",
      "cache-control: no-cache",
      "content-type: application/json"
    ],
  ]);

  $response = curl_exec($curl);
  $err = curl_error($curl);

  curl_close($curl);

  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
  ```

  ```python Python theme={null}
  import http.client

  conn = http.client.HTTPSConnection("")

  payload = "{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "signInEndpoint": "SIGN_IN_ENDPOINT_URL", "signOutEndpoint": "SIGN_OUT_ENDPOINT_URL", "signatureAlgorithm": "rsa-sha256", "digestAlgorithm": "sha256", "fieldsMap": {}, "signingCert": "BASE64_SIGNING_CERT" } }"

  headers = {
      'content-type': "application/json",
      'authorization': "Bearer MGMT_API_ACCESS_TOKEN",
      'cache-control': "no-cache"
      }

  conn.request("POST", "/{yourDomain}/api/v2/connections", payload, headers)

  res = conn.getresponse()
  data = res.read()

  print(data.decode("utf-8"))
  ```

  ```ruby Ruby theme={null}
  require 'uri'
  require 'net/http'
  require 'openssl'

  url = URI("https://{yourDomain}/api/v2/connections")

  http = Net::HTTP.new(url.host, url.port)
  http.use_ssl = true
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER

  request = Net::HTTP::Post.new(url)
  request["content-type"] = 'application/json'
  request["authorization"] = 'Bearer MGMT_API_ACCESS_TOKEN'
  request["cache-control"] = 'no-cache'
  request.body = "{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "signInEndpoint": "SIGN_IN_ENDPOINT_URL", "signOutEndpoint": "SIGN_OUT_ENDPOINT_URL", "signatureAlgorithm": "rsa-sha256", "digestAlgorithm": "sha256", "fieldsMap": {}, "signingCert": "BASE64_SIGNING_CERT" } }"

  response = http.request(request)
  puts response.read_body
  ```
</AuthCodeGroup>

| 値                       | 説明                                                                                                         |
| ----------------------- | ---------------------------------------------------------------------------------------------------------- |
| `MGMT_API_ACCESS_TOKEN` | スコープ `create:connections` を持つ [Management API のアクセストークン](https://auth0.com/docs/api/management/v2/tokens)。 |
| `CONNECTION_NAME`       | 作成する接続の名前。                                                                                                 |
| `SIGN_IN_ENDPONT_URL`   | 作成する接続の SAML シングルログイン URL。                                                                                 |
| `SIGN_OUT_ENDPOINT_URL` | 作成する接続の SAML シングルログアウト URL。                                                                                |
| `BASE64_SIGNING_CERT`   | IdP から取得した X.509 署名証明書 (PEM または CER でエンコードされたもの) 。                                                         |

または、JSON では次のとおりです:

```json lines theme={null}
{
	"strategy": "samlp",
  	"name": "CONNECTION_NAME",
  	"options": {
    	"signInEndpoint": "SIGN_IN_ENDPOINT_URL",
    	"signOutEndpoint": "SIGN_OUT_ENDPOINT_URL",
    	"signatureAlgorithm": "rsa-sha256",
    	"digestAlgorithm": "sha256",
    	"fieldsMap": {
     		...
    	},
    	"signingCert": "BASE64_SIGNING_CERT"
  	}
}
```

<div id="create-a-connection-using-saml-metadata">
  #### SAMLメタデータを使用して接続を作成する
</div>

各 SAML 設定項目を個別に指定する代わりに、設定値を含む SAML メタデータドキュメントを指定できます。SAML メタデータドキュメントを指定する場合は、ドキュメントの XML コンテンツ (`metadataXml`) またはドキュメントの URL (`metadataUrl`) のいずれかを指定できます。URL を指定した場合、コンテンツがダウンロードされるのは 1 回だけです。後でその URL の内容が変更されても、接続が自動的に再構成されることはありません。

SAML 接続の場合、メタデータ検出ドキュメントには 4 MB のサイズ制限が適用されます。この制限を超えると、Auth0 は `SAML metadata document exceeded the maximum allowed size of 4 MB` エラーを返します。

<div id="provide-metadata-document-content">
  ##### メタデータドキュメントの内容を指定する
</div>

`metadataXml` オプションを使用して、ドキュメントの内容を指定します。

<AuthCodeGroup>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://{yourDomain}/api/v2/connections' \
    --header 'authorization: Bearer MGMT_API_ACCESS_TOKEN' \
    --header 'cache-control: no-cache' \
    --header 'content-type: application/json' \
    --data '{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "metadataXml": "<EntityDescriptor entityID='''urn:saml-idp''' xmlns='''urn:oasis:names:tc:SAML:2.0:metadata'''>...</EntityDescriptor>" } }'
  ```

  ```csharp C# theme={null}
  var client = new RestClient("https://{yourDomain}/api/v2/connections");
  var request = new RestRequest(Method.POST);
  request.AddHeader("content-type", "application/json");
  request.AddHeader("authorization", "Bearer MGMT_API_ACCESS_TOKEN");
  request.AddHeader("cache-control", "no-cache");
  request.AddParameter("application/json", "{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "metadataXml": "<EntityDescriptor entityID='urn:saml-idp' xmlns='urn:oasis:names:tc:SAML:2.0:metadata'>...</EntityDescriptor>" } }", ParameterType.RequestBody);
  IRestResponse response = client.Execute(request);
  ```

  ```go Go theme={null}
  package main

  import (
  	"fmt"
  	"strings"
  	"net/http"
  	"io/ioutil"
  )

  func main() {

  	url := "https://{yourDomain}/api/v2/connections"

  	payload := strings.NewReader("{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "metadataXml": "<EntityDescriptor entityID='urn:saml-idp' xmlns='urn:oasis:names:tc:SAML:2.0:metadata'>...</EntityDescriptor>" } }")

  	req, _ := http.NewRequest("POST", url, payload)

  	req.Header.Add("content-type", "application/json")
  	req.Header.Add("authorization", "Bearer MGMT_API_ACCESS_TOKEN")
  	req.Header.Add("cache-control", "no-cache")

  	res, _ := http.DefaultClient.Do(req)

  	defer res.Body.Close()
  	body, _ := ioutil.ReadAll(res.Body)

  	fmt.Println(res)
  	fmt.Println(string(body))

  }
  ```

  ```java Java theme={null}
  HttpResponse<String> response = Unirest.post("https://{yourDomain}/api/v2/connections")
    .header("content-type", "application/json")
    .header("authorization", "Bearer MGMT_API_ACCESS_TOKEN")
    .header("cache-control", "no-cache")
    .body("{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "metadataXml": "<EntityDescriptor entityID='urn:saml-idp' xmlns='urn:oasis:names:tc:SAML:2.0:metadata'>...</EntityDescriptor>" } }")
    .asString();
  ```

  ```javascript Node.JS theme={null}
  var axios = require("axios").default;

  var options = {
    method: 'POST',
    url: 'https://{yourDomain}/api/v2/connections',
    headers: {
      'content-type': 'application/json',
      authorization: 'Bearer MGMT_API_ACCESS_TOKEN',
      'cache-control': 'no-cache'
    },
    data: {
      strategy: 'samlp',
      name: 'CONNECTION_NAME',
      options: {
        metadataXml: '<EntityDescriptor entityID='urn:saml-idp' xmlns='urn:oasis:names:tc:SAML:2.0:metadata'>...</EntityDescriptor>'
      }
    }
  };

  axios.request(options).then(function (response) {
    console.log(response.data);
  }).catch(function (error) {
    console.error(error);
  });
  ```

  ```php PHP theme={null}
  $curl = curl_init();

  curl_setopt_array($curl, [
    CURLOPT_URL => "https://{yourDomain}/api/v2/connections",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "metadataXml": "<EntityDescriptor entityID='urn:saml-idp' xmlns='urn:oasis:names:tc:SAML:2.0:metadata'>...</EntityDescriptor>" } }",
    CURLOPT_HTTPHEADER => [
      "authorization: Bearer MGMT_API_ACCESS_TOKEN",
      "cache-control: no-cache",
      "content-type: application/json"
    ],
  ]);

  $response = curl_exec($curl);
  $err = curl_error($curl);

  curl_close($curl);

  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
  ```

  ```python Python theme={null}
  iimport http.client

  conn = http.client.HTTPSConnection("")

  payload = "{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "metadataXml": "<EntityDescriptor entityID='urn:saml-idp' xmlns='urn:oasis:names:tc:SAML:2.0:metadata'>...</EntityDescriptor>" } }"

  headers = {
      'content-type': "application/json",
      'authorization': "Bearer MGMT_API_ACCESS_TOKEN",
      'cache-control': "no-cache"
      }

  conn.request("POST", "/{yourDomain}/api/v2/connections", payload, headers)

  res = conn.getresponse()
  data = res.read()

  print(data.decode("utf-8"))
  ```

  ```ruby Ruby theme={null}
  require 'uri'
  require 'net/http'
  require 'openssl'

  url = URI("https://{yourDomain}/api/v2/connections")

  http = Net::HTTP.new(url.host, url.port)
  http.use_ssl = true
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER

  request = Net::HTTP::Post.new(url)
  request["content-type"] = 'application/json'
  request["authorization"] = 'Bearer MGMT_API_ACCESS_TOKEN'
  request["cache-control"] = 'no-cache'
  request.body = "{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "metadataXml": "<EntityDescriptor entityID='urn:saml-idp' xmlns='urn:oasis:names:tc:SAML:2.0:metadata'>...</EntityDescriptor>" } }"

  response = http.request(request)
  puts response.read_body
  ```
</AuthCodeGroup>

<div id="provide-a-metadata-document-url">
  ##### メタデータドキュメントの URL を指定する
</div>

`metadataUrl` オプションを使用して、メタデータドキュメントの URL を指定します:

<AuthCodeGroup>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://{yourDomain}/api/v2/connections' \
    --header 'authorization: Bearer MGMT_API_ACCESS_TOKEN' \
    --header 'cache-control: no-cache' \
    --header 'content-type: application/json' \
    --data '{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "metadataUrl": "https://saml-idp/samlp/metadata/uarlU13n63e0feZNJxOCNZ1To3a9H7jX" } }'
  ```

  ```csharp C# theme={null}
  var client = new RestClient("https://{yourDomain}/api/v2/connections");
  var request = new RestRequest(Method.POST);
  request.AddHeader("content-type", "application/json");
  request.AddHeader("authorization", "Bearer MGMT_API_ACCESS_TOKEN");
  request.AddHeader("cache-control", "no-cache");
  request.AddParameter("application/json", "{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "metadataUrl": "https://saml-idp/samlp/metadata/uarlU13n63e0feZNJxOCNZ1To3a9H7jX" } }", ParameterType.RequestBody);
  IRestResponse response = client.Execute(request);
  ```

  ```go Go theme={null}
  package main

  import (
  	"fmt"
  	"strings"
  	"net/http"
  	"io/ioutil"
  )

  func main() {

  	url := "https://{yourDomain}/api/v2/connections"

  	payload := strings.NewReader("{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "metadataUrl": "https://saml-idp/samlp/metadata/uarlU13n63e0feZNJxOCNZ1To3a9H7jX" } }")

  	req, _ := http.NewRequest("POST", url, payload)

  	req.Header.Add("content-type", "application/json")
  	req.Header.Add("authorization", "Bearer MGMT_API_ACCESS_TOKEN")
  	req.Header.Add("cache-control", "no-cache")

  	res, _ := http.DefaultClient.Do(req)

  	defer res.Body.Close()
  	body, _ := ioutil.ReadAll(res.Body)

  	fmt.Println(res)
  	fmt.Println(string(body))

  }
  ```

  ```java Java theme={null}
  HttpResponse<String> response = Unirest.post("https://{yourDomain}/api/v2/connections")
    .header("content-type", "application/json")
    .header("authorization", "Bearer MGMT_API_ACCESS_TOKEN")
    .header("cache-control", "no-cache")
    .body("{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "metadataUrl": "https://saml-idp/samlp/metadata/uarlU13n63e0feZNJxOCNZ1To3a9H7jX" } }")
    .asString();
  ```

  ```javascript Node.JS theme={null}
  var axios = require("axios").default;

  var options = {
    method: 'POST',
    url: 'https://{yourDomain}/api/v2/connections',
    headers: {
      'content-type': 'application/json',
      authorization: 'Bearer MGMT_API_ACCESS_TOKEN',
      'cache-control': 'no-cache'
    },
    data: {
      strategy: 'samlp',
      name: 'CONNECTION_NAME',
      options: {
        metadataUrl: 'https://saml-idp/samlp/metadata/uarlU13n63e0feZNJxOCNZ1To3a9H7jX'
      }
    }
  };

  axios.request(options).then(function (response) {
    console.log(response.data);
  }).catch(function (error) {
    console.error(error);
  });
  ```

  ```php PHP theme={null}
  $curl = curl_init();

  curl_setopt_array($curl, [
    CURLOPT_URL => "https://{yourDomain}/api/v2/connections",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "metadataUrl": "https://saml-idp/samlp/metadata/uarlU13n63e0feZNJxOCNZ1To3a9H7jX" } }",
    CURLOPT_HTTPHEADER => [
      "authorization: Bearer MGMT_API_ACCESS_TOKEN",
      "cache-control: no-cache",
      "content-type: application/json"
    ],
  ]);

  $response = curl_exec($curl);
  $err = curl_error($curl);

  curl_close($curl);

  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
  ```

  ```python Python theme={null}
  import http.client

  conn = http.client.HTTPSConnection("")

  payload = "{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "metadataUrl": "https://saml-idp/samlp/metadata/uarlU13n63e0feZNJxOCNZ1To3a9H7jX" } }"

  headers = {
      'content-type': "application/json",
      'authorization': "Bearer MGMT_API_ACCESS_TOKEN",
      'cache-control': "no-cache"
      }

  conn.request("POST", "/{yourDomain}/api/v2/connections", payload, headers)

  res = conn.getresponse()
  data = res.read()

  print(data.decode("utf-8"))
  ```

  ```ruby Ruby theme={null}
  require 'uri'
  require 'net/http'
  require 'openssl'

  url = URI("https://{yourDomain}/api/v2/connections")

  http = Net::HTTP.new(url.host, url.port)
  http.use_ssl = true
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER

  request = Net::HTTP::Post.new(url)
  request["content-type"] = 'application/json'
  request["authorization"] = 'Bearer MGMT_API_ACCESS_TOKEN'
  request["cache-control"] = 'no-cache'
  request.body = "{ "strategy": "samlp", "name": "CONNECTION_NAME", "options": { "metadataUrl": "https://saml-idp/samlp/metadata/uarlU13n63e0feZNJxOCNZ1To3a9H7jX" } }"

  response = http.request(request)
  puts response.read_body
  ```
</AuthCodeGroup>

URL を指定した場合、コンテンツは 1 回だけダウンロードされます。以後 URL の内容が変更されても、接続が自動的に再構成されることはありません。

<div id="refresh-existing-connection-information-with-metadata-url">
  ##### メタデータURLを使用して既存の接続情報を更新する
</div>

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  この処理が機能するのは、接続が `metadataUrl` を使って手動で作成されている場合のみです。
</Callout>

B2B 実装があり、独自の SAML アイデンティティプロバイダーを使って Auth0 とフェデレーションしている場合は、署名証明書の変更、エンドポイント URL の変更、新しいアサーションフィールドなど、Auth0 に保存されている接続情報の更新が必要になることがあります。Auth0 は ADFS 接続についてはこれを自動的に行いますが、SAML 接続では行いません。

定期的に更新するためのバッチ処理 (cron job) を作成できます。この処理は数週間ごとに実行し、`/api/v2/connections/CONNECTION_ID` エンドポイントに PATCH リクエストを送信して、`{options: {metadataUrl: '$URL'}}` を含むボディを渡します。ここで、`$URL` は接続の作成時に使用したものと同じメタデータ URL です。まず、そのメタデータ URL を使って新しい一時的な接続を作成し、古い接続と新しい接続のプロパティを比較します。差分があれば、新しい接続を更新してから一時的な接続を削除します。

1. `options.metadataUrl` を使って SAML 接続を作成します。接続オブジェクトには、メタデータの情報が設定されます。
2. URL 上のメタデータの内容を更新します。
3. `/api/v2/connections/CONNECTION_ID` エンドポイントに `{options: {metadataUrl: '$URL'}}` を指定して PATCH リクエストを送信します。これで、接続オブジェクトは新しいメタデータの内容で更新されます。

<Warning>
  `options` パラメータを使うと、`options` オブジェクト全体が上書きされます。必要なパラメータがすべて含まれていることを必ず確認してください。
</Warning>

<div id="specify-a-custom-entity-id">
  ## カスタム Entity ID を指定する
</div>

カスタム Entity ID を指定するには、Management API を使用して、デフォルトの `urn:auth0:YOUR_TENANT:YOUR_CONNECTION_NAME` を上書きします。`connection.options.entityID` プロパティは、接続の初回作成時に設定するか、既存の接続を更新して設定します。

以下の JSON の例では、SAML IdP のメタデータ URL を使用して新しい SAML 接続を作成すると同時に、カスタム Entity ID も指定できます。Entity ID は接続名を使って生成されるため、引き続き一意です。

```json lines theme={null}
{
  "strategy": "samlp", 
  "name": "{yourConnectionName}", 
  "options": { 
    "metadataUrl": "https://saml-idp/samlp/metadata/uarlU13n63e0feZNJxOCNZ1To3a9H7jX",
    "entityId": "urn:your-custom-sp-name:{yourConnectionName}"
  }
}
```

<div id="enable-the-enterprise-connection-for-your-auth0-application">
  ## Auth0アプリケーションでエンタープライズ接続を有効にする
</div>

新しいSAMLエンタープライズ接続を使用するには、まずAuth0アプリケーションで[接続を有効にする](/docs/ja-jp/authenticate/identity-providers/enterprise-identity-providers/enable-enterprise-connections)必要があります。

<div id="set-up-mappings">
  ## マッピングを設定する
</div>

<Warning>
  標準以外の PingFederate Server 向けに SAML エンタープライズ接続を設定している場合は、属性マッピングを**必ず**更新してください。
</Warning>

**Mappings** ビューを選択し、`{}` 内にマッピングを入力して、**Save** を選択します。

<Frame>
  <img src="https://mintcdn.com/translations/3nS3prIggmJG9TUI/docs/images/cdy7uua7fh8z/3matGqveShEDX89p8Bcmwr/df5f37c9fb98447badddb1622f79ad95/2025-02-25_09-35-58.png?fit=max&auto=format&n=3nS3prIggmJG9TUI&q=85&s=9e220fee57ff4e2baa09fcc90bcf9598" alt="SAML マッピングを設定する" width="599" height="472" data-path="docs/images/cdy7uua7fh8z/3matGqveShEDX89p8Bcmwr/df5f37c9fb98447badddb1622f79ad95/2025-02-25_09-35-58.png" />
</Frame>

**標準以外の PingFederate Server のマッピング:**

```json lines theme={null}
{
    "user_id": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier",
    "email": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"
}
```

**<Tooltip tip="シングルサインオン（SSO）: ユーザーが1つのアプリケーションにログインすると、他のアプリケーションにも自動的にログインできるようになる仕組みです。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=SSO">SSO</Tooltip> Circle のマッピング**

```json lines theme={null}
{
  "email": "EmailAddress",
  "given_name": "FirstName",
  "family_name": "LastName"
}
```

**2つのクレームのいずれかを1つのユーザー属性にマッピングする**

```json lines theme={null}
{
  "given_name": [
    "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname",
    "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"
  ]
}
```

**Name Identifier をユーザー属性にマッピングする方法**

```json lines theme={null}
{
  "user_id": [
    "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier",
    "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn",
    "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"
  ]
}
```

<div id="test-the-connection">
  ## 接続をテストする
</div>

これで、[接続をテストする](/docs/ja-jp/authenticate/identity-providers/enterprise-identity-providers/test-enterprise-connections)準備が整いました。

<div id="configure-global-token-revocation">
  ## Global Token Revocation を設定する
</div>

この接続タイプは Global Token Revocation エンドポイントをサポートしており、これにより、準拠したアイデンティティプロバイダーは Auth0 のユーザーセッションを無効化し、<Tooltip tip="リフレッシュトークン: ユーザーに再度ログインさせることなく、新しいアクセストークンを取得するために使用されるトークン。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=refresh+tokens">リフレッシュトークン</Tooltip>を無効化し、セキュアなバックチャネルを使用するアプリケーションに対してバックチャネルログアウトをトリガーできます。

この機能は、Okta Workforce Identity の Universal Logout と組み合わせて使用できます。

詳細と設定手順については、[Universal Logout](/docs/ja-jp/authenticate/login/logout/universal-logout)を参照してください。

<div id="learn-more">
  ## 詳細はこちら
</div>

* [Universal Logout](/docs/ja-jp/authenticate/login/logout/universal-logout)
