Remove adl_serializer uses for json

Several pieces of code seems to be using the adl_serializer from
nlohmann.  This unfortunately has very undesirable behavior in some
cases, and makes a lot of things really difficult to track back to the
function that did the serialization, which has caused several bugs in
the past with incorrect types.

This patchset removes them, and opts for the inline version of the
nlohmann json serialization.

Tested:
Booted bmcweb, and logged in.
cat bmcweb_persistent_data.json showed persistent data written properly.

Logged into bmc through webui-vue
systemctl restart bmcweb
Then refreshed webui-vue, and didn't get logged out.

Change-Id: I92868629c54d08b37dd1d956f7c2e2a954f9b670
diff --git a/include/persistent_data.hpp b/include/persistent_data.hpp
index 03457c7..9c86f65 100644
--- a/include/persistent_data.hpp
+++ b/include/persistent_data.hpp
@@ -168,13 +168,38 @@
             std::filesystem::perms::owner_write |
             std::filesystem::perms::group_read;
         std::filesystem::permissions(filename, permission);
+        const auto& c = SessionStore::getInstance().getAuthMethodsConfig();
+        nlohmann::json data{{"auth_config",
+                             {{"XToken", c.xtoken},
+                              {"Cookie", c.cookie},
+                              {"SessionToken", c.sessionToken},
+                              {"BasicAuth", c.basic},
+                              {"TLS", c.tls}}
 
-        nlohmann::json data{
-            {"sessions", SessionStore::getInstance().authTokens},
-            {"auth_config", SessionStore::getInstance().getAuthMethodsConfig()},
-            {"system_uuid", systemUuid},
-            {"revision", jsonRevision},
-            {"timeout", SessionStore::getInstance().getTimeoutInSeconds()}};
+                            },
+                            {"system_uuid", systemUuid},
+                            {"revision", jsonRevision}};
+
+        nlohmann::json& sessions = data["sessions"];
+        sessions = nlohmann::json::array();
+        for (const auto& p : SessionStore::getInstance().authTokens)
+        {
+            if (p.second->persistence !=
+                persistent_data::PersistenceType::SINGLE_REQUEST)
+            {
+                sessions.push_back({
+                    {"unique_id", p.second->uniqueId},
+                    {"session_token", p.second->sessionToken},
+                    {"username", p.second->username},
+                    {"csrf_token", p.second->csrfToken},
+                    {"timeout",
+                     SessionStore::getInstance().getTimeoutInSeconds()},
+#ifdef BMCWEB_ENABLE_IBM_MANAGEMENT_CONSOLE
+                    {"client_id", p.second->clientId},
+#endif
+                });
+            }
+        }
         persistentFile << data;
     }