![]() |
Kea 3.3.3
|
Concrete implementation of the HTTP response creator used for processing API commands. More...
#include <cmd_response_creator.h>
Public Member Functions | |
| CmdResponseCreator (http::HttpAuthConfigPtr http_auth_config, std::unordered_set< std::string > command_accept_list) | |
| Constructor. | |
| virtual | ~CmdResponseCreator ()=default |
| virtual destructor. | |
| virtual http::HttpRequestPtr | createNewHttpRequest () const |
| Create a new request. | |
| virtual http::HttpResponsePtr | createStockHttpResponse (const http::HttpRequestPtr &request, const http::HttpStatusCode &status_code) const |
| Creates stock HTTP response. | |
| http::HttpResponseJsonPtr | filterCommand (const http::HttpRequestPtr &request, const data::ConstElementPtr &body, const std::unordered_set< std::string > &accept) |
| Filter commands. | |
| http::HttpAuthConfigPtr | getAuthConfig () const |
| Fetches the authentication configuration. | |
| std::unordered_set< std::string > | getCommandAcceptList () const |
| Fetches the command accept list. | |
| Public Member Functions inherited from isc::http::HttpResponseCreator | |
| virtual | ~HttpResponseCreator () |
| Destructor. | |
| virtual HttpResponsePtr | createHttpResponse (HttpRequestPtr request) final |
| Create HTTP response from HTTP request received. | |
Static Public Attributes | |
| static bool | EMULATE_AGENT_RESPONSE = true |
| The emulate agent response flag. | |
Concrete implementation of the HTTP response creator used for processing API commands.
See the documentation of the isc::http::HttpResponseCreator for the basic information how HTTP response creators are utilized by the libkea-http library to generate HTTP responses.
This creator expects that received requests are encapsulated in the isc::http::PostHttpRequestJson objects. The generated responses are encapsulated in the HttpResponseJson objects.
This class uses CommandMgr singleton to process commands conveyed in the HTTP body. The JSON responses returned by the manager are placed in the body of the generated HTTP responses.
Definition at line 32 of file cmd_response_creator.h.
|
inline |
Constructor.
| http_auth_config | Authentication configuration. |
| command_accept_list | Command accept list. |
Definition at line 39 of file cmd_response_creator.h.
|
virtualdefault |
virtual destructor.
|
virtual |
Create a new request.
This method creates a bare instance of the isc::http::PostHttpRequestJson.
Implements isc::http::HttpResponseCreator.
Definition at line 29 of file cmd_response_creator.cc.
|
virtual |
Creates stock HTTP response.
| request | Pointer to an object representing HTTP request. |
| status_code | Status code of the response. |
Implements isc::http::HttpResponseCreator.
Definition at line 34 of file cmd_response_creator.cc.
| HttpResponseJsonPtr isc::config::CmdResponseCreator::filterCommand | ( | const http::HttpRequestPtr & | request, |
| const data::ConstElementPtr & | body, | ||
| const std::unordered_set< std::string > & | accept ) |
Filter commands.
From RBAC code: if the access list is empty or the command cannot be found just return.
| request | The HTTP request (for the HTTP version). |
| body | The request body. |
| accept | The accept access list. |
Definition at line 129 of file cmd_response_creator.cc.
References isc::config::COMMAND_HTTP_LISTENER_COMMAND_REJECTED, isc::config::command_logger, isc::config::CONTROL_COMMAND, isc::config::CONTROL_RESULT, isc::config::CONTROL_TEXT, Element::create(), Element::createMap(), isc::config::DBG_COMMAND, isc::http::FORBIDDEN, LOG_DEBUG, isc::http::HttpVersion::major_, Element::map, isc::http::HttpVersion::minor_, isc::http::HttpResponse::statusCodeToNumber(), isc::http::HttpResponse::statusCodeToString(), and Element::string.
|
inline |
Fetches the authentication configuration.
Definition at line 86 of file cmd_response_creator.h.
|
inline |
Fetches the command accept list.
Definition at line 93 of file cmd_response_creator.h.
|
static |
The emulate agent response flag.
Definition at line 81 of file cmd_response_creator.h.