#include "pihttpserverprotected.h" bool PIHTTPServerProtected::registerProtectedPath(const PIString & path, PIHTTP::Method method, RequestFunction handler) { RequestFunction h = std::move(handler); RequestFunction guarded = [this, h](const PIHTTP::MessageConst & r) -> PIHTTP::MessageMutable { if (!authenticate(r).authorized) return accessDeniedReply(r); return h(r); }; return registerPath(path, method, std::move(guarded)); } bool PIHTTPServerProtected::registerProtectedPath(const PIString & path, PIHTTP::Method method, UserRequestFunction handler) { UserRequestFunction h = std::move(handler); RequestFunction guarded = [this, h](const PIHTTP::MessageConst & r) -> PIHTTP::MessageMutable { auto info = authenticate(r); if (!info.authorized) return accessDeniedReply(r); return h(r, info); }; return registerPath(path, method, std::move(guarded)); }