> ## Documentation Index
> Fetch the complete documentation index at: https://auth0.generaltranslation.app/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()) {
              processedNode = processedNode.replace(new RegExp(key, "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 [processedChildren, setProcessedChildren] = useState(children);
  useEffect(() => {
    let unsubscribe = null;
    function init() {
      unsubscribe = window.autorun(() => {
        let processedChildren = children;
        for (const [key, value] of window.rootStore.variableStore.values.entries()) {
          processedChildren = processedChildren.replace(new RegExp(key, "g"), value);
        }
        setProcessedChildren(processedChildren);
      });
    }
    if (window.rootStore) {
      init();
    } else {
      window.addEventListener("adu:storeReady", init);
    }
    return () => {
      window.removeEventListener("adu:storeReady", init);
      unsubscribe?.();
    };
  }, [children]);
  return <CodeBlock filename={filename} icon={icon} language={language} lines highlight={highlight}>
      {processedChildren}
    </CodeBlock>;
};

<div id="common-settings">
  ## 共通設定
</div>

これらは<Tooltip data-tooltip-id="react-containers-DefinitionTooltip-1" href="/docs/ja-JP/ja-jp/glossary?term=security-assertion-markup-language" tip="Security Assertion Markup Language（SAML）: パスワードなしに二者間で認証情報を交換できる標準化プロトコル。" cta="用語集の表示">SAML</Tooltip> IDプロバイダー（<Tooltip data-tooltip-id="react-containers-DefinitionTooltip-2" href="/docs/ja-JP/ja-jp/glossary?term=idp" tip="IDプロバイダー（IdP）: デジタルIDを保存および管理するサービス。" cta="用語集の表示">IdP</Tooltip>）を構成するために使用される設定です。

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  [カスタムドメイン](/docs/ja-JP/ja-jp/customize/custom-domains)を構成した場合は、Auth0ドメインではなく、カスタムドメインのCNAMEを使用しなければなりません。詳細については、「[機能にカスタムドメインの使用を構成する](https://auth0.com/docs/customize/custom-domains/configure-features-to-use-custom-domains#configure-saml-identity-providers)」をお読みください。
</Callout>

<div id="post-back-url">
  ### ポストバックURL
</div>

IdP起点<Tooltip data-tooltip-id="react-containers-DefinitionTooltip-0" href="/docs/ja-JP/ja-jp/glossary?term=single-sign-on" tip="シングルサインオン（SSO）: ユーザーが1つのアプリケーションにログインした後、そのユーザーを他のアプリケーションに自動的にログインさせるサービス。" cta="用語集の表示">SSO</Tooltip>を使用する場合は、必ずポストバックURLに接続パラメーターを含めてください。

export const codeExample1 = `https://{yourDomain}/login/callback?connection={yourConnectionName}`;

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

[Organizations](https://auth0.com/docs/manage-users/organizations)機能を使用している場合は、必要に応じて、目的の組織の組織IDを含む、次の組織パラメーターを含めることもできます。

export const codeExample2 = `https://{yourDomain}/login/callback?connection={yourConnectionName}&organization={yourCustomersOrganizationId}`;

<AuthCodeBlock children={codeExample2} language="http" />

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  ユーザーがこの方法でログインするためには、Organizationに対して接続が有効化されていなければなりません。また、有効な接続で[auto-membership](https://auth0.com/docs/manage-users/organizations/configure-organizations/grant-just-in-time-membership)が構成されているか、ユーザーがそのOrganizationのメンバーでなければなりません。
</Callout>

<div id="entity-id">
  ### エンティティID
</div>

サービスプロバイダーのID：

```http lines theme={null}
urn:auth0:{yourTenant}:{yourConnectionName}
```

`connection.options.entityId`プロパティを使ってカスタムエンティティIDを作成できます。.詳細については、「[カスタムエンティティIDを指定する](/docs/ja-JP/ja-jp/connections/enterprise/saml#specify-a-custom-entity-id)」をお読みください。

カスタムエンティティIDは接続取得エンドポイントを用いて取得することができます。

<AuthCodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://{yourDomain}/api/v2/connections/%7ByourConnectionID%7D' \
    --header 'authorization: Bearer {yourAccessToken}'
  ```

  ```csharp C# theme={null}
  var client = new RestClient("https://{yourDomain}/api/v2/connections/%7ByourConnectionID%7D");
  var request = new RestRequest(Method.GET);
  request.AddHeader("authorization", "Bearer {yourAccessToken}");
  IRestResponse response = client.Execute(request);
  ```

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

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

  func main() {

  	url := "https://{yourDomain}/api/v2/connections/%7ByourConnectionID%7D"

  	req, _ := http.NewRequest("GET", url, nil)

  	req.Header.Add("authorization", "Bearer {yourAccessToken}")

  	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.get("https://{yourDomain}/api/v2/connections/%7ByourConnectionID%7D")
    .header("authorization", "Bearer {yourAccessToken}")
    .asString();
  ```

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

  var options = {
    method: 'GET',
    url: 'https://{yourDomain}/api/v2/connections/%7ByourConnectionID%7D',
    headers: {authorization: 'Bearer {yourAccessToken}'}
  };

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

  ```objc Obj-C theme={null}
  #import <Foundation/Foundation.h>

  NSDictionary *headers = @{ @"authorization": @"Bearer {yourAccessToken}" };

  NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://{yourDomain}/api/v2/connections/%7ByourConnectionID%7D"]
                                                         cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                     timeoutInterval:10.0];
  [request setHTTPMethod:@"GET"];
  [request setAllHTTPHeaderFields:headers];

  NSURLSession *session = [NSURLSession sharedSession];
  NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                              completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                  if (error) {
                                                      NSLog(@"%@", error);
                                                  } else {
                                                      NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
                                                      NSLog(@"%@", httpResponse);
                                                  }
                                              }];
  [dataTask resume];
  ```

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

  curl_setopt_array($curl, [
    CURLOPT_URL => "https://{yourDomain}/api/v2/connections/%7ByourConnectionID%7D",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
      "authorization: Bearer {yourAccessToken}"
    ],
  ]);

  $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("")

  headers = { 'authorization': "Bearer {yourAccessToken}" }

  conn.request("GET", "/{yourDomain}/api/v2/connections/%7ByourConnectionID%7D", headers=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/%7ByourConnectionID%7D")

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

  request = Net::HTTP::Get.new(url)
  request["authorization"] = 'Bearer {yourAccessToken}'

  response = http.request(request)
  puts response.read_body
  ```

  ```swift Swift theme={null}
  import Foundation

  let headers = ["authorization": "Bearer {yourAccessToken}"]

  let request = NSMutableURLRequest(url: NSURL(string: "https://{yourDomain}/api/v2/connections/%7ByourConnectionID%7D")! as URL,
                                          cachePolicy: .useProtocolCachePolicy,
                                      timeoutInterval: 10.0)
  request.httpMethod = "GET"
  request.allHTTPHeaderFields = headers

  let session = URLSession.shared
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
    if (error != nil) {
      print(error)
    } else {
      let httpResponse = response as? HTTPURLResponse
      print(httpResponse)
    }
  })

  dataTask.resume()
  ```
</AuthCodeGroup>

`ACCESS_TOKEN`ヘッダー値をManagement APIv2アクセストークンと置き換えます。

<div id="saml-request-binding">
  ### SAML要求のバインディング
</div>

**Protocol Bindingプロトコルバインディング** とも呼ばれ、Auth0からIdPに送信されます。可能であれば、`connection.options.protocolBinding`に基づいた値を動的に設定します。

<table class="table">
  <thead>
    <tr>
      <th>`connection.options.protocolBinding`の値</th>
      <th>SAML要求のバインディング値</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>空の値（""）または存在しない</td>
      <td>`HTTP-Redirect`</td>
    </tr>

    <tr>
      <td>`urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect`</td>
      <td>`HTTP-Redirect`</td>
    </tr>

    <tr>
      <td>`urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST`</td>
      <td>`HTTP-POST`</td>
    </tr>
  </tbody>
</table>

動的な値の設定が不可能であれば、`HTTP-Redirect`デフォルト値）または`HTTP-Post`を選択します（ **プロトコルバインディング** でこのオプションを選択した場合）。

<div id="saml-response-binding">
  ### SAML応答のバインディング
</div>

`HTTP-Post`として設定されたSAMLトークンを、Auth0がIdPからどのように受け取るか。

<div id="nameid-format">
  ### NameID Format
</div>

指定なし

<div id="saml-assertion-and-response">
  ### SAMLアサーションとSAML応答
</div>

SAMLアサーションとSAML応答は、個別または同時に署名することができます。

<div id="singlelogout-service-url">
  ### SingleLogoutサービスのURL
</div>

これは、SAML IDプロバイダーがログアウトの要求と応答を送信する場所です。

export const codeExample13 = `https://{yourDomain}/logout`;

<AuthCodeBlock children={codeExample13} language="http" />

SAMLログアウト要求は、IDプロバイダーが署名しなければなりません。

<div id="signed-assertions">
  ## 署名されたアサーション
</div>

次のリンクを使用して、異なる形式で公開鍵を取得してください。

* [CER](https://\{yourDomain}/cer?cert=connection)
* [PEM](https://\{yourDomain}/pem?cert=connection)
* [raw PEM](https://\{yourDomain}/rawpem?cert=connection)
* [PKCS#7](https://\{yourDomain}/pb7?cert=connection)
* [指紋](https://\{yourDomain}/fingerprint?cert=connection)

IdPが要求する形式の証明書をダウンロードしてください。

<div id="idp-initiated-single-sign-on">
  ### IdP起点のシングルサインオン
</div>

IdP起点のシングルサインオンについての詳細は、「[IdP起点のシングルサインオンを構成する](/docs/ja-JP/ja-jp/authenticate/protocols/saml/saml-sso-integrations/identity-provider-initiated-single-sign-on)」をお読みください。

<div id="metadata">
  ## メタデータ
</div>

SAML IDプロバイダーによっては、すべての必要な情報を含めたメタデータを直接インポートできるものもあります。Auth0では、接続のメタデータは以下からアクセスできます。

export const codeExample14 = `https://{yourDomain}/samlp/metadata?connection={yourConnectionName}`;

<AuthCodeBlock children={codeExample14} language="http" />

<div id="organizations">
  ## Organizations
</div>

フェデレーションIdPにある組織のACS URLを使用して、組織ログインフローを開始します。

export const codeExample15 = `https://{yourDomain}/samlp?connection={yourConnectionName}&organization={yourOrgID}`;

<AuthCodeBlock children={codeExample15} language="http" />

<div id="learn-more">
  ## もっと詳しく
</div>

* [接続IDまたは名前の検索](/docs/ja-JP/ja-jp/authenticate/identity-providers/locate-the-connection-id)
* [SAMLアサーションをカスタマイズする](/docs/ja-JP/ja-jp/authenticate/protocols/saml/saml-configuration/customize-saml-assertions)
* [SAML構成のトラブルシューティング](/docs/ja-JP/ja-jp/troubleshoot/authentication-issues/troubleshoot-saml-configurations)
