> For the complete documentation index, see [llms.txt](https://docs.lenses.io/latest/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lenses.io/latest/devx/5.5/deployment/configuration/iam/authentication/basic-authentication.md). Agents can also search and read this documentation through its [MCP server](https://docs.lenses.io/latest/~gitbook/mcp).

# Basic Authentication

This page describes configuring basic authentication in Lenses.

With Basic Auth, user accounts are managed by Lenses and a unique username and a password are used to log in.

## Account locking <a href="#account-locking" id="account-locking"></a>

For BASIC and LDAP authentication type, there is the option to set a policy to temporarily lock the account when successive login attempts fail. Once the lock time window has passed the user can log in again.

[Configure account locking](https://docs.lenses.io/latest/devx/5.5/deployment/configuration/iam/authentication.md#account-locking).

## Accounts storage <a href="#accounts-storage" id="accounts-storage"></a>

The internal database that stores user/group information is stored on disk, under the `lenses.storage.directory` or an external Postgres database.

If using the embedded H2 database keep this directory intact between updates and upgrades.

## Password rules <a href="#password-rules" id="password-rules"></a>

To enforce specific password rules the following configurations need to be set:

{% code title="security.conf" %}

```bash
# The regex security.confcheck the password. If it does not meet the requirements adding a user account or changing the
# password will be rejected.
lenses.security.basic.password.rules.regex = "((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})"

# Human readable description for the password rule. This will be returned to the user when the requirements fail
lenses.security.basic.password.rules.desc = "Password needs to contain: one lower case, one upper case, 1 number, one special character, and have a length of 6 to 20 characters"
```

{% endcode %}

## Password history <a href="#password-history" id="password-history"></a>

To not allow previous passwords to be reused, use the following configuration:

{% code title="security.conf" %}

```bash
# When a user tries to change her password, she cannot use any the last # passwords used in the past
# Default value is 1
lenses.security.basic.password.history.count = 3
```

{% endcode %}


---

# 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://docs.lenses.io/latest/devx/5.5/deployment/configuration/iam/authentication/basic-authentication.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.
