Beignet API reference
    Preparing search index...

    Function createAuthHooks

    • Create metadata-driven authentication hooks.

      By default the hook reads contract.metadata.auth: "required" or true requires an authenticated session, "optional" attaches a session when one exists, and missing/false metadata treats the route as public. The hook identifies a user; business authorization still belongs in policies or use cases.

      Type Parameters

      Parameters

      • Optionaloptions: AuthHooksOptions<Ctx, InferAuthSession<Ctx["ports"]["auth"]>>

        Optional auth mode, session lookup, context assignment, and unauthorized response customization.

      Returns ServerHook<Ctx, Ctx["ports"]>

      A server hook that runs before route handlers.

    • Create metadata-driven authentication hooks.

      By default the hook reads contract.metadata.auth: "required" or true requires an authenticated session, "optional" attaches a session when one exists, and missing/false metadata treats the route as public. The hook identifies a user; business authorization still belongs in policies or use cases.

      Type Parameters

      • Ctx
      • Session

      Parameters

      Returns ServerHook<Ctx>

      A server hook that runs before route handlers.