handler: Add Max-Age to cookies (#32)

Add Max-Age to checkpoint-token cookie, so that the cookie persists
after the end of the current session.
This commit is contained in:
catfromplan9
2025-05-11 12:08:42 +00:00
committed by GitHub
parent 5022e37917
commit 02313315af

View File

@@ -317,7 +317,7 @@ void CServerHandler::challengeSubmitted(const Pistache::Http::Request& req, Pist
}
response.headers().add(
std::make_shared<SetCookieHeader>(std::string{TOKEN_COOKIE_NAME} + "=" + TOKEN.tokenCookie() + "; Domain=" + hostDomain + "; HttpOnly; Path=/; Secure; SameSite=Lax"));
std::make_shared<SetCookieHeader>(std::string{TOKEN_COOKIE_NAME} + "=" + TOKEN.tokenCookie() + "; Domain=" + hostDomain + "; Max-Age=" + std::to_string(g_pConfig->m_config.token_valid_for) + "; HttpOnly; Path=/; Secure; SameSite=Lax"));
if (js)
response.send(Pistache::Http::Code::Ok, "Ok");