mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 18:32:45 +00:00 
			
		
		
		
	 79a47d9bd3
			
		
	
	
		79a47d9bd3
		
	
	
	
	
		
			
			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. :^)
		
			
				
	
	
		
			32 lines
		
	
	
	
		
			843 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			32 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;
 | |
| };
 | |
| 
 | |
| }
 |