auth: change authorization.hpp to authentication.hpp
The existing authorization header is actually doing "authentication"
work. The authorization is happening in routing.hpp where we fetch the
role of the authenticated user and get their privilege set.
This commits changes the name of the file, as well as the namespace, to
be more precise on what the file actually does.
Tested:
1. Trivial change, it builds
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ib91ed70507a7308522c7e5363ed2f4dc279a19d9
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
index 339294c..564593c 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "bmcweb_config.h"
-#include "authorization.hpp"
+#include "authentication.hpp"
#include "http_response.hpp"
#include "http_utility.hpp"
#include "logging.hpp"
@@ -356,7 +356,7 @@
return;
}
#ifndef BMCWEB_INSECURE_DISABLE_AUTHENTICATION
- if (!crow::authorization::isOnAllowlist(req->url, req->method()) &&
+ if (!crow::authentication::isOnAllowlist(req->url, req->method()) &&
thisReq.session == nullptr)
{
BMCWEB_LOG_WARNING << "Authentication failed";
@@ -435,7 +435,7 @@
addSecurityHeaders(*req, res);
- crow::authorization::cleanupTempSession(*req);
+ crow::authentication::cleanupTempSession(*req);
if (!isAlive())
{
@@ -577,7 +577,7 @@
sessionIsFromTransport = false;
#ifndef BMCWEB_INSECURE_DISABLE_AUTHENTICATION
boost::beast::http::verb method = parser->get().method();
- userSession = crow::authorization::authenticate(
+ userSession = crow::authentication::authenticate(
ip, res, method, parser->get().base(), userSession);
bool loggedIn = userSession != nullptr;
diff --git a/include/authorization.hpp b/include/authentication.hpp
similarity index 99%
rename from include/authorization.hpp
rename to include/authentication.hpp
index d50695b..3c1ca48 100644
--- a/include/authorization.hpp
+++ b/include/authentication.hpp
@@ -18,7 +18,7 @@
namespace crow
{
-namespace authorization
+namespace authentication
{
static void cleanupTempSession(Request& req)
@@ -311,5 +311,5 @@
return nullptr;
}
-} // namespace authorization
+} // namespace authentication
} // namespace crow