Loading...
Searching...
No Matches
basic_auth.h
#pragma once
#include <functional>
#include <string>
#include "CivetServer.h"
#include "civetweb.h"
namespace prometheus {
class BasicAuthHandler : public CivetAuthHandler {
public:
using AuthFunc = std::function<bool(const std::string&, const std::string&)>;
explicit BasicAuthHandler(AuthFunc callback, std::string realm);
bool authorize(CivetServer* server, mg_connection* conn) override;
private:
bool AuthorizeInner(CivetServer* server, mg_connection* conn);
void WriteUnauthorizedResponse(mg_connection* conn);
AuthFunc callback_;
std::string realm_;
};
} // namespace prometheus
prometheus::BasicAuthHandler
Definition basic_auth.h:14
prometheus::BasicAuthHandler::authorize
bool authorize(CivetServer *server, mg_connection *conn) override
Definition basic_auth.cc:13