# Application users

`users` defines credentials for visitors to your deployed application. These accounts are separate from workspace sign-in and Git credentials. Defining users alone does not protect any route; add matching access rules.

Application user fields

| Field | Type / default | Behavior |
| --- | --- | --- |
| username | String; required | Unique login name. Whitespace is trimmed and letters are lowercased. A colon is not allowed. |
| password | String; required | Encoded Argon2 password hash, not a plaintext password. Use an Argon2id hash generated through Environment, or supply a compatible encoded hash. |
| roles | Array of strings; \[\] | Role names assigned to the user. Names are trimmed, lowercased, and accept alphanumeric characters and underscores. Use nonempty names such as `admin` or `reader`. |
| xref\_id | String or null; null | Optional external reference stored with the user. It does not affect authentication or roles and is not the value of the forwarded user-ID header. |

To configure a password without committing it, open Environment, add `ADMIN_PASSWORD_HASH`, leave **Package** blank, enter the intended password, and select **Argon2id** as the transform. Reference the stored hash with `"password": "${ADMIN_PASSWORD_HASH}"`. Set it before enabling the rule, then deploy or rebuild. The user logs in with the original password.

Use unique usernames. Password hashes are omitted from the Config view. For a request authenticated by a rule, Leilani removes the Basic Authorization header and forwards `X-Leilani-User-ID` containing the normalized username and `X-Leilani-User-Roles` containing a JSON array of roles. Incoming values for these identity headers are removed before authentication.
