alepha@docs:~/docs/reference/primitives$
cat $basicAuth.md
1 min read

#$basicAuth

#Import

typescript
1import { $basicAuth } from "alepha/security";

#Overview

Middleware that enforces HTTP Basic Authentication on the request.

Works with request context only (HTTP). Reads the Authorization: Basic header, validates credentials using timing-safe comparison, and throws 401 if invalid.

typescript
1class DevToolsController {2  dashboard = $action({3    use: [$basicAuth({ username: "admin", password: "secret" })],4    handler: async () => { ... },5  });6}

#Options

Option Type Required Description
username string Yes
password string Yes