> For the complete documentation index, see [llms.txt](https://ayakaleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ayakaleaf-pro.ayaka.space/on-premises/ja/yzoyobipurojekuto/user-management/migrating-to-ldap-or-saml.md).

# LDAP または SAML への移行

```
{
  _id:        '123',
  email:      'alice@example.com'
  first_name: 'Alice',
  last_name:  'Jones'
}
```

では、これを会社のLDAP/Active Directoryシステムに統合したいとします。そのシステムでは、Aliceの詳細は次のとおりです:

```
Alice:
  - uid:  'alicejones'
  - mail: 'alicejones@tech.example.com'
  - givenName:   'Alice'
  - sn: 'Jones'
```

目的は、AliceがLDAPのユーザー名（`alicejones`）とパスワードを、以前のOverleafの認証情報の代わりに使ってログインし、作業内容を失わないようにすることです。その方法は次のとおりです。

{% hint style="warning" %}
この手順では、 **sharelatex** コンテナを再作成する必要があり、その間に多少のダウンタイムが発生します。まずはテスト/ステージング環境でこの手順を一通り試し、流れに慣れておくことを強くおすすめします。
{% endhint %}

{% stepper %}
{% step %}

### ユーザーにメールアドレスの更新を依頼する

Overleafアカウントはメールアドレスに紐づいているため、まずユーザーのOverleafメールをLDAPまたはSAMLのメールと一致させる必要があります。

この例では、AliceにOverleafアカウントへサインインして、メールアドレスを `alice@example.com` から `alicejones@tech.example.com`.

{% hint style="warning" %}
自分の分も忘れずに！ 管理者なら、自分のメールアドレスも更新する必要があります。
{% endhint %}

{% hint style="success" %}
ユーザー数が多い場合は、 [ユーザー名の移行](/on-premises/ja/yzoyobipurojekuto/user-management/username-migration.md) スクリプトを使ってユーザーの主メールアドレスを一括変更できます。
{% endhint %}
{% endstep %}

{% step %}

### LDAPまたはSAMLモジュールを有効にする

全員のメールアドレスが更新できたら、いよいよ切り替えです！ 新しい認証方式に必要な環境変数を設定し、その後 **sharelatex** 次の方法でコンテナを再作成します: `bin/up -d` コマンド。

これにより、標準のOverleafログインフォームが、新しいLDAPまたはSAMLのフォームに置き換わります。

{% hint style="info" %}
LDAPを有効にするための関連情報は [こちら](/on-premises/ja/she-ding/overleaf-toolkit/authentication/ldap-authentication.md)、およびSAML 2.0について [こちら](/on-premises/ja/she-ding/overleaf-toolkit/authentication/saml-authentication.md).
{% endhint %}
{% endstep %}

{% step %}

### これでユーザーはLDAPまたはSAMLでログインできます

次にAliceがログインしようとすると、新しいフォームが表示されます。

![LDAP/Active Directoryログインページ](/files/6fdd5fb8a049174d7c2f3525fdd71fd277610955)

LDAPユーザー名（`alicejones`）とパスワードを入力できます。メールアドレスがLDAPのものと一致しているため、既存のOverleafアカウントにそのままログインできます。プロジェクトはすべて、最後に置いた場所のままです。

SAML 2.0を有効にしている場合、ユーザーにはボタンが表示され、それをクリックするとIdPにリダイレクトされて認証情報を入力できます。認証に成功すると、Overleafインスタンスに戻され、アカウントにログインされます。

![SAMLログインページ](/files/cc911740eb6dc1edfd2d642a0c088972c207a034)

{% hint style="info" %}
次を参照してください [環境変数](broken://pages/f551e336de5a86c3f4fe6bfa88c2b6919b241a94) ログインページの表示や操作をカスタマイズするための情報ページ。

また、ロールバックが必要になったら、LDAP/SAMLの設定をコメントアウトして、 **sharelatex** 次の方法でコンテナを再作成します: `bin/up -d` コマンド。するとユーザーは、現在のメールアドレスとOverleaf専用のパスワードでログインできるようになります。
{% endhint %}
{% endstep %}
{% endstepper %}

## 逆方向: LDAP/SAMLからネイティブ認証に戻す

しばらくLDAPまたはSAMLを使っていて、Overleaf内蔵のログインシステムに移行したい場合はどうでしょう（LDAPを廃止したのかもしれません）？ 問題ありません！ 切り替え方法は次のとおりです。

{% stepper %}
{% step %}

### 全員のメールアドレスが正しいことを確認する

ユーザーのアカウントはすでにLDAPまたはSAMLのメールアドレスにリンクされています。今後ログインに使うメールアドレスなので、内容に問題がないか確認するだけで大丈夫です。
{% endstep %}

{% step %}

### LDAPまたはSAMLモジュールを無効にする

LDAP/SAMLの設定を削除または未設定にして、 **sharelatex** 次の方法でコンテナを再作成します: `bin/up -d` コマンド。これで、Overleaf標準のメールアドレスとパスワードのログインフォームが戻ります。

![ネイティブ認証ログインページ](/files/3947e142214a12c980c062f5a1b4e2aae6ff65dd)
{% endstep %}

{% step %}

### ユーザーにパスワードの再設定を依頼する

ユーザーが今ログインページを開くと、LDAP/SAMLのフォームではなくOverleafのログインフォームが表示されます。

ネイティブのOverleafパスワードを一度も持っていない可能性があるため、新しく作成する必要があります。各ユーザーは次の手順を行ってください:

* 「パスワードをお忘れですか？」リンクをクリックする。
* アカウントに関連付けられたメールアドレス（LDAP/SAMLのもの）を入力する。
* パスワード再設定メールのリンクを開き、新しいパスワードを設定する。

{% hint style="info" %}
まだであれば、有効化に関するガイドもご覧ください: [メール配信](/on-premises/ja/she-ding/overleaf-toolkit/email-delivery.md).
{% endhint %}

これが完了したら、メールアドレスと新しいOverleaf専用パスワードでログインし、すべてのプロジェクトにアクセスできます。
{% endstep %}
{% endstepper %}


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ayakaleaf-pro.ayaka.space/on-premises/ja/yzoyobipurojekuto/user-management/migrating-to-ldap-or-saml.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
