Files
retoor 3c4334cec9 feat: implement MoloApp plans 01-15 with integration
Full C++23 framework tree: runtime, observability, security,
data, app, realtime, supervisor, clients, CLI, example plus
enterprise tenancy, audit, operability, governance,
supplychain. Postgres via docker compose for tests.
2026-10-23 18:20:04 +02:00

22 lines
705 B
C++

// Route: GET /auth/me (Basic auth)
#include "support/Assert.hpp"
using namespace molo::example::test;
using molo::example::fw::Method;
int main() {
Fixture f;
auto anon = f.client->get("/auth/me");
check(anon.status == 401, "no header is 401");
auto bad = f.client->request(
Method::Get, "/auth/me", "",
{{"Authorization", "Basic YWRhOndyb25n"}});
check(bad.status == 403, "bad password is 403");
auto ok = f.client->request(
Method::Get, "/auth/me", "",
{{"Authorization", "Basic YWRhOmNvcnJlY3QtaG9yc2U="}});
check(ok.status == 200, "good credentials are 200");
check(contains(ok.body, "\"user\":\"ada\""), "identity returned");
return finish("auth/me");
}