> 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/pt/configuracao/overleaf-toolkit/authentication.md).

# Autenticação

Esta funcionalidade foi desenvolvida por [yu-i-i/overleaf-cep](https://github.com/yu-i-i/overleaf-cep). Existem 3 métodos de autenticação suportados. Após a configuração, você pode iniciar sessão com as seguintes opções, como a imagem abaixo mostra.

<figure><img src="/files/476b08d3f369f43e059b0c2199432d96dc39836e" alt=""><figcaption></figcaption></figure>

Recomendamos fortemente que use OIDC, uma vez que este é o método mais geral.

{% columns %}
{% column width="50%" %}
{% content-ref url="/pages/0aac0288289c9802e6f6d85c860d39d874f96145" %}
[Autenticação OIDC](/on-premises/pt/configuracao/overleaf-toolkit/authentication/oidc-authentication.md)
{% endcontent-ref %}

{% content-ref url="/pages/f1b7b7fa22298aefd67a71a280483867f7f8eb8e" %}
[Autenticação LDAP](/on-premises/pt/configuracao/overleaf-toolkit/authentication/ldap-authentication.md)
{% endcontent-ref %}
{% endcolumn %}

{% column width="50%" %}
{% content-ref url="/pages/14aac592bafdb16263db986af48366a78a0653d2" %}
[Autenticação SAML](/on-premises/pt/configuracao/overleaf-toolkit/authentication/saml-authentication.md)
{% endcontent-ref %}
{% endcolumn %}
{% endcolumns %}

### Configuração global

A variável de ambiente `EXTERNAL_AUTH` é necessário para ativar o módulo de autenticação específico. Esta variável de ambiente especifica quais métodos de autenticação externos estão ativados. As opções disponíveis são (em minúsculas):

* saml
* ldap
* oidc

### Sugestões para SSO

Testei saml, ldap, oauth no overleaf. Tanto saml como oauth funcionam bem no overleaf, mas ldap depende. Não consegue funcionar bem para <https://docs.goauthentik.io/>, mas funciona bem em openLDAP (<https://github.com/rroemhild/docker-test-openldap>).

{% hint style="info" %}
Precisamos atualizar o passport-ldapauth; recentemente estou a tentar testar o LDAP do Overleaf com <https://goauthentik.io/> , falhou. Depois de atualizar "passport-ldapauth" para 3.0.0, tudo funciona bem.

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

A versão original é 2.x.x, que é de há 6 anos.
{% endhint %}

Não tenho certeza de qual é a razão, porque todos dependemos de um pacote externo para fazer autenticação LDAP (também saml, oauth). Se não funcionar, a situação pode ser a mesma para o Overleaf Server Pro, porque apenas passámos todas as variáveis de ambiente para o pacote interno; se houver alguns bugs, atualmente não fazemos ideia.

**Por isso, recomendo fortemente que o nosso utilizador configure um ambiente de desenvolvimento para testar o SSO com todo o código-fonte**, que está disponível em [Setup Develop Environment (Local)](/dev/environment/setup-develop-environment-local.md). No ambiente de desenvolvimento, pode ver todos os registos no terminal, o que facilita a depuração.

\ <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://ayakaleaf-pro.ayaka.space/on-premises/pt/configuracao/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.
