Write the clang-tidy file OpenBMC needs

Now that CI can handle clang-tidy, and a lot of the individual fixes
have landed for the various static analysis checks, lets see how close
we are.

This includes bringing a bunch of the code up to par with the checks
that require.  Most of them fall into the category of extraneous else
statements, const correctness problems, or extra copies.

Tested:
CI only.  Unit tests pass.

Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: I9fbd346560a75fdd3901fa40c57932486275e912
diff --git a/include/authorization.hpp b/include/authorization.hpp
index 24dbb7b..634620b 100644
--- a/include/authorization.hpp
+++ b/include/authorization.hpp
@@ -34,7 +34,7 @@
     }
 }
 
-static const std::shared_ptr<persistent_data::UserSession>
+static std::shared_ptr<persistent_data::UserSession>
     performBasicAuth(std::string_view auth_header)
 {
     BMCWEB_LOG_DEBUG << "[AuthMiddleware] Basic authentication";
@@ -79,7 +79,7 @@
         isConfigureSelfOnly);
 }
 
-static const std::shared_ptr<persistent_data::UserSession>
+static std::shared_ptr<persistent_data::UserSession>
     performTokenAuth(std::string_view auth_header)
 {
     BMCWEB_LOG_DEBUG << "[AuthMiddleware] Token authentication";
@@ -90,7 +90,7 @@
     return session;
 }
 
-static const std::shared_ptr<persistent_data::UserSession>
+static std::shared_ptr<persistent_data::UserSession>
     performXtokenAuth(const crow::Request& req)
 {
     BMCWEB_LOG_DEBUG << "[AuthMiddleware] X-Auth-Token authentication";
@@ -105,7 +105,7 @@
     return session;
 }
 
-static const std::shared_ptr<persistent_data::UserSession>
+static std::shared_ptr<persistent_data::UserSession>
     performCookieAuth(const crow::Request& req)
 {
     BMCWEB_LOG_DEBUG << "[AuthMiddleware] Cookie authentication";
@@ -130,7 +130,7 @@
     std::string_view authKey =
         cookieValue.substr(startIndex, endIndex - startIndex);
 
-    const std::shared_ptr<persistent_data::UserSession> session =
+    std::shared_ptr<persistent_data::UserSession> session =
         persistent_data::SessionStore::getInstance().loginSessionByToken(
             authKey);
     if (session == nullptr)
@@ -163,7 +163,7 @@
 }
 
 #ifdef BMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION
-static const std::shared_ptr<persistent_data::UserSession>
+static std::shared_ptr<persistent_data::UserSession>
     performTLSAuth(const crow::Request& req, Response& res,
                    std::weak_ptr<persistent_data::UserSession> session)
 {
@@ -176,24 +176,19 @@
                              << " will be used for this request.";
             return sp;
         }
-        else
+        std::string_view cookieValue = req.getHeaderValue("Cookie");
+        if (cookieValue.empty() ||
+            cookieValue.find("SESSION=") == std::string::npos)
         {
-            std::string_view cookieValue = req.getHeaderValue("Cookie");
-            if (cookieValue.empty() ||
-                cookieValue.find("SESSION=") == std::string::npos)
-            {
-                // TODO: change this to not switch to cookie auth
-                res.addHeader(
-                    "Set-Cookie",
-                    "XSRF-TOKEN=" + sp->csrfToken +
-                        "; Secure\r\nSet-Cookie: SESSION=" + sp->sessionToken +
-                        "; Secure; HttpOnly\r\nSet-Cookie: "
-                        "IsAuthenticated=true; Secure");
-                BMCWEB_LOG_DEBUG
-                    << " TLS session: " << sp->uniqueId
-                    << " with cookie will be used for this request.";
-                return sp;
-            }
+            // TODO: change this to not switch to cookie auth
+            res.addHeader("Set-Cookie", "XSRF-TOKEN=" + sp->csrfToken +
+                                            "; Secure\r\nSet-Cookie: SESSION=" +
+                                            sp->sessionToken +
+                                            "; Secure; HttpOnly\r\nSet-Cookie: "
+                                            "IsAuthenticated=true; Secure");
+            BMCWEB_LOG_DEBUG << " TLS session: " << sp->uniqueId
+                             << " with cookie will be used for this request.";
+            return sp;
         }
     }
     return nullptr;