Handler options
Validated authorization handler configuration
import { buildAuthorizationHandler } from "@.../caddy-api-client/plugins/caddy-security";
const handler = buildAuthorizationHandler({
gatekeeperName: "mygatekeeper",
});
// Protect a route
const route: CaddyRoute = {
match: [{ host: ["api.example.com"] }],
handle: [
handler, // Check auth first
{ handler: "reverse_proxy", upstreams: [{ dial: "localhost:3000" }] },
],
terminal: true,
};
Build an authorization handler
Creates a caddy-security authorization handler that validates JWT/PASETO tokens and enforces access control policies.
This uses Caddy's built-in
authenticationhandler with the caddy-securityauthorizerprovider.