Add both Basic auth and CGI support

This commit is contained in:
2025-12-04 13:24:23 -06:00
parent abe444d22b
commit 2861fba6f2
15 changed files with 315 additions and 18 deletions

View File

@@ -0,0 +1,18 @@
#pragma once
#include "HttpServer.hpp"
namespace Tesses::Framework::Http {
class BasicAuthServer : public Tesses::Framework::Http::IHttpServer
{
public:
std::shared_ptr<IHttpServer> server;
std::function<bool(std::string username, std::string password)> authorization;
std::string realm;
BasicAuthServer();
BasicAuthServer(std::shared_ptr<IHttpServer> server, std::function<bool(std::string username, std::string password)> auth,std::string realm="Protected Content");
bool Handle(ServerContext& ctx);
static bool GetCreds(ServerContext& ctx, std::string& user, std::string& pass);
};
}