Kea: auth_config.h Source File

| Kea 3.2.0-git

auth_config.h
Go to the documentation of this file.
1// Copyright (C) 2020-2022 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef HTTP_AUTH_CONFIG_H
8#define HTTP_AUTH_CONFIG_H
9
10#include <cc/cfg_to_element.h>
11#include <cc/data.h>
12#include <cc/simple_parser.h>
13#include <cc/user_context.h>
14#include <http/request.h>
15#include <http/response_creator.h>
16#include <http/response_json.h>
17
18namespace isc {
19 namespace http {
20
22 class HttpAuthConfig : public isc::data::UserContext,
23 public isc::data::CfgToElement {
24public:
25
27 virtual ~HttpAuthConfig() { }
28
32 void setRealm(const std::string& realm) {
33 realm_ = realm;
34 }
35
39 const std::string& getRealm() const {
40 return (realm_);
41 }
42
46 void setDirectory(const std::string& directory) {
47 directory_ = directory;
48 }
49
53 const std::string& getDirectory() const {
54 return (directory_);
55 }
56
61 virtual bool empty() const = 0;
62
64 virtual void clear() = 0;
65
71 virtual void parse(const isc::data::ConstElementPtr& config) = 0;
72
76 virtual isc::data::ElementPtr toElement() const = 0;
77
83 virtual isc::http::HttpResponseJsonPtr
84 checkAuth(const isc::http::HttpResponseCreator& creator,
85 const isc::http::HttpRequestPtr& request) const = 0;
86
87private:
88
90 std::string realm_;
91
93 std::string directory_;
94};
95
97 typedef boost::shared_ptr<HttpAuthConfig> HttpAuthConfigPtr;
98
99} // end of namespace isc::http
100} // end of namespace isc
101
102#endif // endif HTTP_AUTH_CONFIG_H
cfg_to_element.h
isc::http::HttpAuthConfig
Base type of HTTP authentication configuration.
Definition auth_config.h:23
isc::http::HttpAuthConfig::toElement
virtual isc::data::ElementPtr toElement() const =0
Unparses HTTP authentication configuration.
isc::http::HttpAuthConfig::parse
virtual void parse(const isc::data::ConstElementPtr &config)=0
Parses HTTP authentication configuration.
isc::http::HttpAuthConfig::checkAuth
virtual isc::http::HttpResponseJsonPtr checkAuth(const isc::http::HttpResponseCreator &creator, const isc::http::HttpRequestPtr &request) const =0
Validate HTTP request.
isc::http::HttpAuthConfig::getRealm
const std::string & getRealm() const
Returns the realm.
Definition auth_config.h:39
isc::http::HttpAuthConfig::getDirectory
const std::string & getDirectory() const
Returns the common part for file paths (usually a directory).
Definition auth_config.h:53
isc::http::HttpAuthConfig::~HttpAuthConfig
virtual ~HttpAuthConfig()
Destructor.
Definition auth_config.h:27
isc::http::HttpAuthConfig::empty
virtual bool empty() const =0
Empty predicate.
isc::http::HttpAuthConfig::setDirectory
void setDirectory(const std::string &directory)
Set the common part for file paths (usually a directory).
Definition auth_config.h:46
isc::http::HttpAuthConfig::setRealm
void setRealm(const std::string &realm)
Set the realm.
Definition auth_config.h:32
isc::http::HttpAuthConfig::clear
virtual void clear()=0
Clear configuration.
isc::http::HttpResponseCreator
Specifies an interface for classes creating HTTP responses from HTTP requests.
Definition response_creator.h:38
data.h
simple_parser.h
isc::config
Definition command_interpreter.cc:23
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:30
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition data.h:29
isc::http
Definition auth_config.h:19
isc::http::HttpAuthConfigPtr
boost::shared_ptr< HttpAuthConfig > HttpAuthConfigPtr
Type of shared pointers to HTTP authentication configuration.
Definition auth_config.h:97
isc::http::HttpResponseJsonPtr
boost::shared_ptr< HttpResponseJson > HttpResponseJsonPtr
Pointer to the HttpResponseJson object.
Definition response_json.h:27
isc::http::HttpRequestPtr
boost::shared_ptr< HttpRequest > HttpRequestPtr
Pointer to the HttpRequest object.
Definition request.h:30
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18
request.h
response_creator.h
response_json.h
isc::data::CfgToElement
Abstract class for configuration Cfg_* classes.
Definition cfg_to_element.h:29
isc::data::UserContext
Base class for user context.
Definition user_context.h:22
user_context.h