> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/ja-gitbook-documentation/akauntoto/sso-and-saml.md).

# SSO と SAML

SSO と SAML を通じてGitBookコンテンツを共有する方法を学ぶ

メールドメインまたは SAML シングルサインオン（SSO）を使って、組織へのアクセスを管理します。どちらも組織の **設定** → **アクセス**.

## メールドメイン経由のシングルサインオン

メールドメインを追加すると、確認済みのメールアドレスが一致する人がサインイン時に組織に参加できるようになります。

メールドメインを設定するには:

1. 組織メニューで、 **設定**.
2. 「 **組織**」の下にある **アクセス**.
3. 「 **許可するメールドメイン**」の下に、許可する各ドメインを追加します。例： `mycompany.com`.
4. 「 **新しいメンバー**」の下で、自動的に参加するユーザーに適用する **デフォルトのロール** を選択します。

職場のメールドメインのみ追加できます。 `gmail.com`などの個人用メールドメインは追加できません。

<figure><img src="broken://files/17aa08cb2a4803d45d126c4e07ce428531f6147d" alt="The Access management settings showing allowed email domains, the default role for new members, and the option to register a SAML identity provider"><figcaption><p>組織用の SSO を設定します。</p></figcaption></figure>

{% hint style="info" %}
デフォルトのロールは、IDプロバイダー経由で参加するメンバーにも適用されます。メンバーのロールはいつでも **組織 → メンバー**.
{% endhint %}

## SAML シングルサインオン

SAML SSO により、メンバーは IdP（アイデンティティプロバイダー）経由でアクセスできます。

GitBook はメンバー認証に IdP を使用します。組織管理者は別の方法でもサインインできます。これにより、SSO の設定を誤ってもロックアウトされるのを防げます。

### 前提条件 <a href="#prerequisites-for-sso-with-gitbook" id="prerequisites-for-sso-with-gitbook"></a>

SAML SSO は Enterprise プランで利用できます。

* 会社の ID プロバイダー（IdP）が次の規格に対応している必要があります。 **SAML 2.0** 規格。
* IdP で管理者権限が必要です。
* GitBook 組織の管理者である必要があります。

### GitBook で SAML を設定する <a href="#setup-on-gitbook" id="setup-on-gitbook"></a>

SAMLを設定するには、 [組織管理者](https://gitbook.com/docs/documentation/ja-gitbook-documentation/collaborate/member-management/roles.md#admin) である必要があります。

SAML を設定するには:

1. 組織メニューで、 **設定**.
2. 「 **組織**」の下にある **アクセス**.
3. 「 **SAML**」の下にある **IDプロバイダーを登録** をクリックし、IdPの詳細情報を入力します。
4. 設定を保存し、SSO サインイン URL をメンバーと共有します。

GitBook は、設定を保存した後に案内メールを送信しません。

{% hint style="info" %}
「 **SSOを強制** 」が有効になっていても、組織管理者はSSO以外の方法でサインインできます。そのため、Google、GitHub、メールの選択肢が表示される場合があります。

これにより、SSO の設定に失敗しても組織にアクセスできなくなるのを防げます。管理者はいつでもサインインして、SSO 設定を削除または修正できます。
{% endhint %}

IdP から次の詳細が必要です:

* **ラベル** — サインインページに表示されます。
* **エンティティID**.
* **シングルサインオンURL**.
* **X.509証明書** — 証明書全体を含めてください。

### IdP を設定する <a href="#setup-on-the-idp" id="setup-on-the-idp"></a>

ほとんどのSAML 2.0準拠IdPでは、サービスプロバイダーの詳細情報が必要です。GitBookで **設定 → 組織 → アクセス** を開き、「 **SAML**.

SAML の設定を完了するには、これらの値を IdP にコピーしてください。

」の下にある組織の値を確認します。GitBookでは、 **NameID** にメンバーのメールアドレスを含める必要があります。NameIDの形式には、 `urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress` を使用します。多くのIdPでは、この形式は次のような名前で提供されています **メールアドレス**.

### カスタム属性

GitBook はアカウント作成時に、SAML アサーションからこれらのカスタム属性を読み取ります。

| 項目           | 説明                                                                |
| ------------ | ----------------------------------------------------------------- |
| `first_name` | `first_name` と `last_name` フィールドを組み合わせて、GitBookでユーザーに表示する名前を生成します |
| `last_name`  | `first_name` と `last_name` フィールドを組み合わせて、GitBookでユーザーに表示する名前を生成します |

## エンドユーザーアカウントの作成 <a href="#creating-end-user-account" id="creating-end-user-account"></a>

メンバーを追加するには、IdP でそのメンバーのアカウントを作成します。新しいメンバーが IdP 経由で初めて GitBook にログインすると、自動 IdP プロビジョニングによって GitBook アカウントが作成されます。ユーザーは組織メンバーとして組織のリソースにアクセスできます。

{% hint style="danger" %}
セットアップには小文字のメールアドレスが必要です。大文字と小文字が混在するメールアドレスは使用しないでください。‌
{% endhint %}

## アカウントの削除 <a href="#removing-end-user-accounts" id="removing-end-user-accounts"></a>

IdPからメンバーを削除すると、ユーザーは対応するGitBookアカウントにサインインできなくなりますが、 **GitBookからアカウントが削除されるわけではありません**。GitBookの組織からもアカウントを削除することをおすすめします。

## アクセスの制御

SAML SSO を設定したら、誰が GitBook アカウントにアクセスできるかを制御する責任は IdP にあります。

## セキュリティに関する注意 <a href="#security-notice" id="security-notice"></a>

GitBook は、管理者に代わって既存のアカウントをあなたの IdP にリンクすることはありません。リンクできるのはアカウント所有者のみで、IdP 経由でサインインすることで行えます。

すでにあなたの IdP が送信するメールアドレスで GitBook アカウントを持っている人がいる場合、SAML でサインインしても、その人は自動的にあなたの組織に追加されません。アクセス権を付与するには:

1. その人をあなたの組織に招待してください。
   * 「 **SSOを強制** 」が有効になっていない場合は、組織の設定にある **メンバー** から招待してください。
   * 「 **SSOを強制** 」が有効になっている場合は、 `invites`  APIエンドポイントを使用し、 `"sso": true`:

     ```bash
     curl --request POST \
       --url "https://api.gitbook.com/v1/orgs/<org_id>/invites" \
       --header "Authorization: Bearer <your_access_token>" \
       --header "Content-Type: application/json" \
       --data-raw '{ "sso": true, "role": "<role>", "emails": ["<email>"] }'
     ```
2. その人に、既存のアカウントで GitBook にサインインして、あなたの組織を開くよう依頼してください。GitBook が促したら、IdP 経由でサインインすることで、その人のアカウントがあなたの SSO にリンクされます。

を指定してください。この招待により、既存のアカウントはすぐにメンバーとして追加されます。アカウントはまだIdPにリンクされていないため、APIレスポンスでは `failedSSOEmails`に表示されます。招待によって作成されたアカウントは、すぐにリンクされます。

{% hint style="info" %}
GitBookアカウントは、一度に1つの組織のSSOにのみリンクできます。アカウントがすでに別の組織にリンクされている場合、そのアカウントの所有者は、 **SSOを強制** が有効になっている組織のコンテンツを開けません。
{% endhint %}

別の方法として、その人は既存の GitBook アカウントを削除してから、SAML を使ってあなたの組織にサインインできます。GitBook は新しいアカウントを作成し、それをあなたの組織に追加します。アカウントを削除すると、他のすべての組織へのアクセス権も削除されます。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://gitbook.com/docs/documentation/ja-gitbook-documentation/akauntoto/sso-and-saml.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
