# Authentication

Portainer provides its own internal authentication mechanism, encrypting user passwords and storing them in the local Portainer database. Alternatively, external authentication providers are available. In this section, we explain how to authenticate via LDAP, Active Directory and OAuth.

{% hint style="info" %}
For all authentication types you can adjust the session lifetime (the time before users are forced to reauthenticate). The default is 8 hours.

Session lifetime changes apply only to new logins, existing sessions keep their original expiry.&#x20;

Expired sessions redirect to login without ending the upstream OAuth session.
{% endhint %}

When using internal authentication, an administrator can set the minimum length for users' passwords. The default is 12 characters, but this can be adjusted using the slider. Any users with passwords that don't meet the requirements will be asked to update their passwords when they next log in.

<figure><img src="/files/ErdnJPZUu34Y8AyG4yVw" alt=""><figcaption></figcaption></figure>

{% content-ref url="/pages/-MhRYDCDXB50h663xcJQ" %}
[Authenticate via LDAP](/admin/settings/authentication/ldap.md)
{% endcontent-ref %}

{% content-ref url="/pages/OhXe3r7TLVMCsqO1EOVw" %}
[Authenticate via Active Directory](/admin/settings/authentication/active-directory.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MhRYOd3HU8B0KbWEQBp" %}
[Authenticate via OAuth](/admin/settings/authentication/oauth.md)
{% endcontent-ref %}


---

# Agent Instructions: 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:

```
GET https://docs.portainer.io/admin/settings/authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
