@accelerated-software-development/caddy-api-client - v0.4.3
    Preparing search index...

    Function buildAuthorizationHandler

    • 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 authentication handler with the caddy-security authorizer provider.

      Parameters

      Returns {
          handler: "authentication";
          providers: {
              authorizer: { gatekeeper_name?: string; route_matcher?: string };
          };
      }

      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,
      };