deleted rootfs and auth_service

This commit is contained in:
wt
2024-12-15 01:58:36 +07:00
parent b694830190
commit 85652a4e99
156 changed files with 0 additions and 2051 deletions
+25
View File
@@ -0,0 +1,25 @@
#include "auth.hpp"
#include <sstream>
#include <httplib.h>
#include "../routes.hpp"
#include <json.hpp>
#include "../types.hpp"
bool authenticate(const std::string &token)
{
httplib::Client cli(AUTH_SERVICE);
std::stringstream body;
body << R"({"token":")" << token << R"("})";
httplib::Result res = cli.Post("/api/access", body.str(), JSON_TYPE);
if (res->status == httplib::OK_200)
{
nlohmann::json resjson = nlohmann::json::parse(res->body);
if (resjson["access"] == "reject")
{
return false;
}
return true;
}
return false;
}