src/lib/dhcpsrv/dhcpsrv_messages.mes
src/lib/dhcpsrv/alloc_engine_messages.mes
src/lib/dhcpsrv/hosts_messages.mes
+src/lib/http/auth_messages.mes
src/lib/http/http_messages.mes
src/lib/dhcp_ddns/dhcp_ddns_messages.mes
src/lib/database/db_messages.mes
mes_files += $(top_srcdir)/src/lib/dhcpsrv/dhcpsrv_messages.mes
mes_files += $(top_srcdir)/src/lib/dhcpsrv/alloc_engine_messages.mes
mes_files += $(top_srcdir)/src/lib/dhcpsrv/hosts_messages.mes
+mes_files += $(top_srcdir)/src/lib/http/auth_messages.mes
mes_files += $(top_srcdir)/src/lib/http/http_messages.mes
mes_files += $(top_srcdir)/src/lib/dhcp_ddns/dhcp_ddns_messages.mes
mes_files += $(top_srcdir)/src/lib/database/db_messages.mes
libkea_http_la_SOURCES += response_creator_factory.h
libkea_http_la_SOURCES += response_json.cc response_json.h
libkea_http_la_SOURCES += url.cc url.h
-libkea_http_la_SOURCES += basic_auth.cc basic_auth.h
libkea_http_la_SOURCES += auth_config.h
+libkea_http_la_SOURCES += auth_log.cc auth_log.h
+libkea_http_la_SOURCES += auth_messages.cc auth_messages.h
libkea_http_la_SOURCES += basic_auth_config.cc basic_auth_config.h
+libkea_http_la_SOURCES += basic_auth.cc basic_auth.h
libkea_http_la_CXXFLAGS = $(AM_CXXFLAGS)
libkea_http_la_CPPFLAGS = $(AM_CPPFLAGS)
# is required. To make it easy to rebuild messages without going through
# reconfigure, a new target messages-clean has been added.
maintainer-clean-local:
+ rm -f auth_messages.cc auth_messages.h
rm -f http_messages.h http_messages.cc
# To regenerate messages files, one can do:
if GENERATE_MESSAGES
# Define rule to build logging source files from message file
-messages: http_messages.h http_messages.cc
+messages: auth_messages.cc auth_messages.h http_messages.h http_messages.cc
@echo Message files regenerated
+auth_messages.cc auth_messages.h: auth_messages.mes
+ $(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/lib/http/auth_messages.mes
+
http_messages.h http_messages.cc: http_messages.mes
$(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/lib/http/http_messages.mes
libkea_http_includedir = $(pkgincludedir)/http
libkea_http_include_HEADERS = \
auth_config.h \
+ auth_log.h \
+ auth_messages.h \
basic_auth.h \
basic_auth_config.h \
client.h \
--- /dev/null
+// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC")
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+/// Defines the logger used by the HTTP authentication.
+
+#include <config.h>
+
+#include <http/auth_log.h>
+
+namespace isc {
+namespace http {
+
+/// @brief Defines the logger used by the HTTP authentication.
+isc::log::Logger auth_logger("http-auth");
+
+} // namespace http
+} // namespace isc
+
--- /dev/null
+// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC")
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef AUTH_LOG_H
+#define AUTH_LOG_H
+
+#include <log/logger_support.h>
+#include <log/macros.h>
+#include <http/auth_messages.h>
+
+namespace isc {
+namespace http {
+
+/// Define the HTTP authentication logger.
+extern isc::log::Logger auth_logger;
+
+} // namespace http
+} // namespace isc
+
+#endif // AUTH_LOG_H
--- /dev/null
+// File created from ../../../src/lib/http/auth_messages.mes
+
+#include <cstddef>
+#include <log/message_types.h>
+#include <log/message_initializer.h>
+
+namespace isc {
+namespace http {
+
+extern const isc::log::MessageID HTTP_CLIENT_REQUEST_AUTHORIZED = "HTTP_CLIENT_REQUEST_AUTHORIZED";
+extern const isc::log::MessageID HTTP_CLIENT_REQUEST_BAD_AUTH_HEADER = "HTTP_CLIENT_REQUEST_BAD_AUTH_HEADER";
+extern const isc::log::MessageID HTTP_CLIENT_REQUEST_NOT_AUTHORIZED = "HTTP_CLIENT_REQUEST_NOT_AUTHORIZED";
+extern const isc::log::MessageID HTTP_CLIENT_REQUEST_NO_AUTH_HEADER = "HTTP_CLIENT_REQUEST_NO_AUTH_HEADER";
+
+} // namespace http
+} // namespace isc
+
+namespace {
+
+const char* values[] = {
+ "HTTP_CLIENT_REQUEST_AUTHORIZED", "received HTTP request authorized for '%1'",
+ "HTTP_CLIENT_REQUEST_BAD_AUTH_HEADER", "received HTTP request with malformed authentication header: %1",
+ "HTTP_CLIENT_REQUEST_NOT_AUTHORIZED", "received HTTP request with not matching authentication header",
+ "HTTP_CLIENT_REQUEST_NO_AUTH_HEADER", "received HTTP request without required authentication header",
+ NULL
+};
+
+const isc::log::MessageInitializer initializer(values);
+
+} // Anonymous namespace
+
--- /dev/null
+// File created from ../../../src/lib/http/auth_messages.mes
+
+#ifndef AUTH_MESSAGES_H
+#define AUTH_MESSAGES_H
+
+#include <log/message_types.h>
+
+namespace isc {
+namespace http {
+
+extern const isc::log::MessageID HTTP_CLIENT_REQUEST_AUTHORIZED;
+extern const isc::log::MessageID HTTP_CLIENT_REQUEST_BAD_AUTH_HEADER;
+extern const isc::log::MessageID HTTP_CLIENT_REQUEST_NOT_AUTHORIZED;
+extern const isc::log::MessageID HTTP_CLIENT_REQUEST_NO_AUTH_HEADER;
+
+} // namespace http
+} // namespace isc
+
+#endif // AUTH_MESSAGES_H
--- /dev/null
+# Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC")
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+$NAMESPACE isc::http
+
+% HTTP_CLIENT_REQUEST_AUTHORIZED received HTTP request authorized for '%1'
+This information message is issued when the server receives with a matching
+authentication header. The argument provides the user id.
+
+% HTTP_CLIENT_REQUEST_BAD_AUTH_HEADER received HTTP request with malformed authentication header: %1
+This information message is issued when the server receives a request with
+a malformed authentication header. The argument explains the problem.
+
+% HTTP_CLIENT_REQUEST_NOT_AUTHORIZED received HTTP request with not matching authentication header
+This information message is issued when the server receives a request with
+authentication header carrying not recognized credential: the user
+provided incorrect user id and/or password.
+
+% HTTP_CLIENT_REQUEST_NO_AUTH_HEADER received HTTP request without required authentication header
+This information message is issued when the server receives a request without
+a required authentication header.
-// Copyright (C) 2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2020-2021 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <config.h>
+#include <http/auth_log.h>
#include <http/basic_auth_config.h>
-#include <http/http_log.h>
#include <util/strutil.h>
using namespace isc;
// Verify the credential is in the list.
const auto it = credentials.find(value);
if (it != credentials.end()) {
- LOG_INFO(http_logger, HTTP_CLIENT_REQUEST_AUTHORIZED)
+ LOG_INFO(auth_logger, HTTP_CLIENT_REQUEST_AUTHORIZED)
.arg(it->second);
authentic = true;
} else {
- LOG_INFO(http_logger, HTTP_CLIENT_REQUEST_NOT_AUTHORIZED);
+ LOG_INFO(auth_logger, HTTP_CLIENT_REQUEST_NOT_AUTHORIZED);
authentic = false;
}
} catch (const HttpMessageNonExistingHeader&) {
- LOG_INFO(http_logger, HTTP_CLIENT_REQUEST_NO_AUTH_HEADER);
+ LOG_INFO(auth_logger, HTTP_CLIENT_REQUEST_NO_AUTH_HEADER);
} catch (const BadValue& ex) {
- LOG_INFO(http_logger, HTTP_CLIENT_REQUEST_BAD_AUTH_HEADER)
+ LOG_INFO(auth_logger, HTTP_CLIENT_REQUEST_BAD_AUTH_HEADER)
.arg(ex.what());
}
if (authentic) {
-// Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2021 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-/// Defines the logger used by the top-level component of kea-dhcp-ddns.
+/// Defines the logger used by the libkea-http library.
#include <config.h>
namespace isc {
namespace http {
-/// Define the loggers used within libkea-http library.
+/// Define the logger used within libkea-http library.
extern isc::log::Logger http_logger;
} // namespace http
extern const isc::log::MessageID HTTP_BAD_SERVER_RESPONSE_RECEIVED = "HTTP_BAD_SERVER_RESPONSE_RECEIVED";
extern const isc::log::MessageID HTTP_BAD_SERVER_RESPONSE_RECEIVED_DETAILS = "HTTP_BAD_SERVER_RESPONSE_RECEIVED_DETAILS";
extern const isc::log::MessageID HTTP_CLIENT_MT_STARTED = "HTTP_CLIENT_MT_STARTED";
-extern const isc::log::MessageID HTTP_CLIENT_REQUEST_AUTHORIZED = "HTTP_CLIENT_REQUEST_AUTHORIZED";
-extern const isc::log::MessageID HTTP_CLIENT_REQUEST_BAD_AUTH_HEADER = "HTTP_CLIENT_REQUEST_BAD_AUTH_HEADER";
-extern const isc::log::MessageID HTTP_CLIENT_REQUEST_NOT_AUTHORIZED = "HTTP_CLIENT_REQUEST_NOT_AUTHORIZED";
-extern const isc::log::MessageID HTTP_CLIENT_REQUEST_NO_AUTH_HEADER = "HTTP_CLIENT_REQUEST_NO_AUTH_HEADER";
extern const isc::log::MessageID HTTP_CLIENT_REQUEST_RECEIVED = "HTTP_CLIENT_REQUEST_RECEIVED";
extern const isc::log::MessageID HTTP_CLIENT_REQUEST_RECEIVED_DETAILS = "HTTP_CLIENT_REQUEST_RECEIVED_DETAILS";
extern const isc::log::MessageID HTTP_CLIENT_REQUEST_SEND = "HTTP_CLIENT_REQUEST_SEND";
"HTTP_BAD_SERVER_RESPONSE_RECEIVED", "bad response received when communicating with %1: %2",
"HTTP_BAD_SERVER_RESPONSE_RECEIVED_DETAILS", "detailed information about bad response received from %1:\n%2",
"HTTP_CLIENT_MT_STARTED", "HttpClient has been started in multi-threaded mode running %1 threads",
- "HTTP_CLIENT_REQUEST_AUTHORIZED", "received HTTP request authorized for '%1'",
- "HTTP_CLIENT_REQUEST_BAD_AUTH_HEADER", "received HTTP request with malformed authentication header: %1",
- "HTTP_CLIENT_REQUEST_NOT_AUTHORIZED", "received HTTP request with not matching authentication header",
- "HTTP_CLIENT_REQUEST_NO_AUTH_HEADER", "received HTTP request without required authentication header",
"HTTP_CLIENT_REQUEST_RECEIVED", "received HTTP request from %1",
"HTTP_CLIENT_REQUEST_RECEIVED_DETAILS", "detailed information about well-formed request received from %1:\n%2",
"HTTP_CLIENT_REQUEST_SEND", "sending HTTP request %1 to %2",
extern const isc::log::MessageID HTTP_BAD_SERVER_RESPONSE_RECEIVED;
extern const isc::log::MessageID HTTP_BAD_SERVER_RESPONSE_RECEIVED_DETAILS;
extern const isc::log::MessageID HTTP_CLIENT_MT_STARTED;
-extern const isc::log::MessageID HTTP_CLIENT_REQUEST_AUTHORIZED;
-extern const isc::log::MessageID HTTP_CLIENT_REQUEST_BAD_AUTH_HEADER;
-extern const isc::log::MessageID HTTP_CLIENT_REQUEST_NOT_AUTHORIZED;
-extern const isc::log::MessageID HTTP_CLIENT_REQUEST_NO_AUTH_HEADER;
extern const isc::log::MessageID HTTP_CLIENT_REQUEST_RECEIVED;
extern const isc::log::MessageID HTTP_CLIENT_REQUEST_RECEIVED_DETAILS;
extern const isc::log::MessageID HTTP_CLIENT_REQUEST_SEND;
This debug message is issued when a multi-threaded HTTP client instance has
been created. The argument specifies the maximum number of threads.
-% HTTP_CLIENT_REQUEST_AUTHORIZED received HTTP request authorized for '%1'
-This information message is issued when the server receives with a matching
-authentication header. The argument provides the user id.
-
-% HTTP_CLIENT_REQUEST_BAD_AUTH_HEADER received HTTP request with malformed authentication header: %1
-This information message is issued when the server receives a request with
-a malformed authentication header. The argument explains the problem.
-
-% HTTP_CLIENT_REQUEST_NOT_AUTHORIZED received HTTP request with not matching authentication header
-This information message is issued when the server receives a request with
-authentication header carrying not recognized credential: the user
-provided incorrect user id and/or password.
-
-% HTTP_CLIENT_REQUEST_NO_AUTH_HEADER received HTTP request without required authentication header
-This information message is issued when the server receives a request without
-a required authentication header.
-
% HTTP_CLIENT_REQUEST_RECEIVED received HTTP request from %1
This debug message is issued when the server finished receiving a HTTP
request from the remote endpoint. The address of the remote endpoint is