> For the complete documentation index, see [llms.txt](https://coldbox-security.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://coldbox-security.ortusbooks.com/get-started/configuration/basic-auth.md). Agents can also search and read this documentation through its [MCP server](https://coldbox-security.ortusbooks.com/~gitbook/mcp).

# Basic Auth

Configuration for basic authentication

The `basicAuth` key is used to store user credentials that will be used with [Basic Authentication](https://coldbox-security.ortusbooks.com/authentication/basic-authentication.md) and how the passwords are stored in memory.

```javascript
/**
 * --------------------------------------------------------------------------
 * Basic Auth
 * --------------------------------------------------------------------------
 * These settings are used so you can configure the hashing patterns of the user storage
 * included with cbsecurity.  These are only used if you are using the `BasicAuthUserService` as
 * your service of choice alongside the `BasicAuthValidator`
 */
basicAuth : {
	// Hashing algorithm to use
	hashAlgorithm  : "SHA-512",
	// Iterates the number of times the hash is computed to create a more computationally intensive hash.
	hashIterations : 5,
	// User storage: The `key` is the username. The value is the user credentials that can include
	// { roles: "", permissions : "", firstName : "", lastName : "", password : "" }
	users          : {}
}
```

### HashAlgorithm

This is the default algorithm used when hashing the user storage passwords in memory. The default is `SHA-512`

```javascript
hashAlgorithm  : "SHA-256",
```

### HashIterations

Iterates the number of times the hash is computed to create a more computationally intensive hash. The default is `5`

```javascript
hashIterations  : 10,
```

### Users

This is the in-memory user storage system. It's a `struct` and each **key** represents a unique `username` in the storage system. Each user can then have the following attributes, but in reality, you can add as many attributes as you want.

* `password` - The only mandatory attribute.
* `firstName`
* `lastName`
* `roles`
* `permissions`

```javascript
users : {
    "lmajano" : { password : "test", permissions : "read,write",
    "guest" : { password : "guest", permissions : "read" }
}
```


---

# 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://coldbox-security.ortusbooks.com/get-started/configuration/basic-auth.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.
