ladybird/Userland/Services/WebServer/Configuration.h
Max Wipfli 79a47d9bd3 WebServer: Add support for HTTP basic authentication
This enables the WebServer to run protected by a username and password.
While it isn't possible to access such a protected server from inside
Serenity as of now (because neither the Browser nor pro(1) support
this), this may very well be the case in the future. :^)
2021-06-11 11:37:15 +02:00

33 lines
843 B
C++

/*
* Copyright (c) 2021, Max Wipfli <mail@maxwipfli.ch>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Optional.h>
#include <AK/String.h>
#include <LibHTTP/HttpRequest.h>
namespace WebServer {
class Configuration {
public:
Configuration(String root_path);
String const& root_path() const { return m_root_path; }
Optional<HTTP::HttpRequest::BasicAuthenticationCredentials> const& credentials() const { return m_credentials; }
void set_root_path(String root_path) { m_root_path = move(root_path); }
void set_credentials(Optional<HTTP::HttpRequest::BasicAuthenticationCredentials> credentials) { m_credentials = move(credentials); }
static Configuration const& the();
private:
String m_root_path;
Optional<HTTP::HttpRequest::BasicAuthenticationCredentials> m_credentials;
};
}