token: use an http header for the token

This commit is contained in:
Vaxry
2025-04-13 17:58:27 +01:00
parent 4986f525f6
commit 1c5758c466
5 changed files with 33 additions and 5 deletions

View File

@@ -4,6 +4,7 @@
#include "../headers/xforwardfor.hpp"
#include "../headers/gitProtocolHeader.hpp"
#include "../headers/acceptLanguageHeader.hpp"
#include "../headers/setCookieHeader.hpp"
#include "../debug/log.hpp"
#include "../GlobalState.hpp"
#include "../config/Config.hpp"
@@ -344,6 +345,8 @@ void CServerHandler::challengeSubmitted(const Pistache::Http::Request& req, Pist
resp.success = true;
resp.token = TOKEN;
response.headers().add(std::make_shared<SetCookieHeader>("CheckpointToken=" + TOKEN + "; HttpOnly; Path=/; Secure; SameSite=Lax"));
response.send(Pistache::Http::Code::Ok, glz::write_json(resp).value());
}