Kea 2.7.5
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>
16#include <http/response_json.h>
17
18namespace isc {
19namespace http {
20
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
85 const isc::http::HttpRequestPtr& request) const = 0;
86
87private:
88
90 std::string realm_;
91
93 std::string directory_;
94};
95
97typedef 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
Base type of HTTP authentication configuration.
Definition auth_config.h:23
virtual isc::data::ElementPtr toElement() const =0
Unparses HTTP authentication configuration.
virtual void parse(const isc::data::ConstElementPtr &config)=0
Parses HTTP authentication configuration.
virtual isc::http::HttpResponseJsonPtr checkAuth(const isc::http::HttpResponseCreator &creator, const isc::http::HttpRequestPtr &request) const =0
Validate HTTP request.
const std::string & getRealm() const
Returns the realm.
Definition auth_config.h:39
const std::string & getDirectory() const
Returns the common part for file paths (usually a directory).
Definition auth_config.h:53
virtual ~HttpAuthConfig()
Destructor.
Definition auth_config.h:27
virtual bool empty() const =0
Empty predicate.
void setDirectory(const std::string &directory)
Set the common part for file paths (usually a directory).
Definition auth_config.h:46
void setRealm(const std::string &realm)
Set the realm.
Definition auth_config.h:32
virtual void clear()=0
Clear configuration.
Specifies an interface for classes creating HTTP responses from HTTP requests.
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
boost::shared_ptr< HttpAuthConfig > HttpAuthConfigPtr
Type of shared pointers to HTTP authentication configuration.
Definition auth_config.h:97
boost::shared_ptr< HttpResponseJson > HttpResponseJsonPtr
Pointer to the HttpResponseJson object.
boost::shared_ptr< HttpRequest > HttpRequestPtr
Pointer to the HttpRequest object.
Definition request.h:30
Defines the logger used by the top-level component of kea-lfc.
Abstract class for configuration Cfg_* classes.
Base class for user context.