> For the complete documentation index, see [llms.txt](https://overleaf-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://overleaf-pro.ayaka.space/on-premises/zh-tw/she-ding/overleaf-toolkit/authentication.md).

# 驗證

此功能由 [yu-i-i/overleaf-cep](https://github.com/yu-i-i/overleaf-cep)。系統支援 3 種驗證方法。設定完成後，您可以使用以下選項登入，如下圖所示。

<figure><img src="/files/41e84c56dacfbc5670be2de709e6c39001102330" alt=""><figcaption></figcaption></figure>

我們非常建議您使用 OIDC，因為這是最通用的方法。

{% columns %}
{% column width="50%" %}
{% content-ref url="/spaces/aYBDqbkYDnTcIpu08Wjf/pages/996dcb69a4b8a4d5e4be98829d45884c639658ce" %}
[OIDC 驗證](/on-premises/zh-tw/she-ding/overleaf-toolkit/authentication/oidc-authentication.md)
{% endcontent-ref %}

{% content-ref url="/spaces/aYBDqbkYDnTcIpu08Wjf/pages/af6c98454af02ff9c2fd16b025e0916d06a52c1e" %}
[LDAP 驗證](/on-premises/zh-tw/she-ding/overleaf-toolkit/authentication/ldap-authentication.md)
{% endcontent-ref %}
{% endcolumn %}

{% column width="50%" %}
{% content-ref url="/spaces/aYBDqbkYDnTcIpu08Wjf/pages/cea5624e1c2684ec3b18c19c8e59209126c2521c" %}
[SAML 驗證](/on-premises/zh-tw/she-ding/overleaf-toolkit/authentication/saml-authentication.md)
{% endcontent-ref %}

{% endcolumn %}
{% endcolumns %}

### 全域設定

環境變數 `EXTERNAL_AUTH` 需要啟用特定的驗證模組。此環境變數用來指定要啟用哪些外部驗證方法。可用選項如下（小寫）：

* saml
* ldap
* oidc

### SSO 建議

我在 Overleaf 上測試了 saml、ldap、oauth。saml 和 oauth 在 Overleaf 上運作良好，但 ldap 則視情況而定。它無法很好地運作於 <https://docs.goauthentik.io/>，但它在 openLDAP（<https://github.com/rroemhild/docker-test-openldap>).

{% hint style="info" %}
我們需要更新 passport-ldapauth，最近我正在嘗試在 Overleaf 上測試 ldap，搭配 <https://goauthentik.io/> ，結果失敗了。當我將「passport-ldapauth」更新為 3.0.0 後，一切運作良好。

```
"passport-ldapauth": "^3.0.0",
```

原本的是 2.x.x，距今已是 6 年前。
{% endhint %}

我不確定原因是什麼，因為我們都依賴外部套件來進行 LDAP（以及 saml、oauth）驗證。如果無法運作，Overleaf Server Pro 的情況也可能相同，因為我們只是把所有環境變數傳給內部套件；如果其中有 bug，我們目前也無從得知。

**因此我非常建議使用者建立開發環境，並使用完整原始碼來測試 SSO**，可在以下位置取得 [Setup Develop Environment (Local)](/dev/environment/setup-develop-environment-local.md)。在開發環境中，您可以在終端機看到所有日誌，這使除錯更加方便。

\ <br>


---

# 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://overleaf-pro.ayaka.space/on-premises/zh-tw/she-ding/overleaf-toolkit/authentication.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.
