openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
18 lines (17 loc) • 1.05 kB
JavaScript
import { a as resolvePluginRoutePathContext, i as isProtectedPluginRoutePathFromContext, t as findMatchingPluginHttpRoutes } from "./route-match-DlTv7M6i.js";
//#region src/gateway/server/plugins-http/route-auth.ts
/**
* Gateway-auth decisions for plugin HTTP routes.
*/
function matchedPluginRoutesRequireGatewayAuth(routes) {
return routes.some((route) => route.auth === "gateway");
}
/** Returns true when a plugin path must pass gateway auth before routing. */
function shouldEnforceGatewayAuthForPluginPath(registry, pathnameOrContext) {
const pathContext = typeof pathnameOrContext === "string" ? resolvePluginRoutePathContext(pathnameOrContext) : pathnameOrContext;
if (pathContext.malformedEncoding || pathContext.decodePassLimitReached) return true;
if (isProtectedPluginRoutePathFromContext(pathContext)) return true;
return matchedPluginRoutesRequireGatewayAuth(findMatchingPluginHttpRoutes(registry, pathContext));
}
//#endregion
export { shouldEnforceGatewayAuthForPluginPath as n, matchedPluginRoutesRequireGatewayAuth as t };