> 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).

# Basic Authentication

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