function authMiddleware
authMiddleware(): MiddlewareFunction

Authentication middleware that runs passive strategies and populates ctx.request.user. Always calls next() - it authenticates only, does not authorize.

Examples

Example 1

// Priority 300 is the band ARCHITECTURE.md §10 reserves for authentication;
// a bare add() would take the kernel default of 500 and run after it.
app.middleware.add(authMiddleware(), { priority: 300 });

Return Type

MiddlewareFunction

Middleware function

Usage

import { authMiddleware } from "auth-plugin/src/index.ts";