summaryrefslogtreecommitdiff
path: root/include/sessions.hpp
diff options
context:
space:
mode:
authorGunnar Mills <gmills@us.ibm.com>2020-11-12 00:37:34 +0300
committerGunnar Mills <gmills@us.ibm.com>2020-11-12 18:02:18 +0300
commit83cf8189e5f9d414efb5c5fa73227e977cf5f84d (patch)
tree095c617bd3e9b83c990e40dbd6d5f04375dd3c1f /include/sessions.hpp
parent9f8bfa7c6deb3808e3679d332479311dc4202819 (diff)
downloadbmcweb-83cf8189e5f9d414efb5c5fa73227e977cf5f84d.tar.xz
Call applySessionTimeouts before writing data
Before writing bmcweb_persistent_data.json on bmcweb shutdown call applySessionTimeouts() to ensure no stale sessions are wrote. To accomplish this had to move applySessionTimeouts to public. Tested: Stop bmcweb, modify bmcweb_persistent_data.json timeout to be 30 seconds. Start bmcweb. Verify timeout 30 seconds and 1 session is restored. Wait 1 min. stop bmcweb. Verify no sessions in bmcweb_persistent_data.json. Signed-off-by: Gunnar Mills <gmills@us.ibm.com> Change-Id: Idfaf7c144b3bdeb2741b48f603d7213ac1a51f10
Diffstat (limited to 'include/sessions.hpp')
-rw-r--r--include/sessions.hpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/include/sessions.hpp b/include/sessions.hpp
index 7cdb82a17b..1eace0ddad 100644
--- a/include/sessions.hpp
+++ b/include/sessions.hpp
@@ -346,23 +346,6 @@ class SessionStore
return sessionStore;
}
- SessionStore(const SessionStore&) = delete;
- SessionStore& operator=(const SessionStore&) = delete;
-
- std::unordered_map<std::string, std::shared_ptr<UserSession>,
- std::hash<std::string>,
- crow::utility::ConstantTimeCompare>
- authTokens;
-
- std::chrono::time_point<std::chrono::steady_clock> lastTimeoutUpdate;
- bool needWrite{false};
- std::chrono::seconds timeoutInSeconds;
- AuthConfigMethods authMethodsConfig;
-
- private:
- SessionStore() : timeoutInSeconds(3600)
- {}
-
void applySessionTimeouts()
{
auto timeNow = std::chrono::steady_clock::now();
@@ -390,6 +373,23 @@ class SessionStore
}
}
}
+
+ SessionStore(const SessionStore&) = delete;
+ SessionStore& operator=(const SessionStore&) = delete;
+
+ std::unordered_map<std::string, std::shared_ptr<UserSession>,
+ std::hash<std::string>,
+ crow::utility::ConstantTimeCompare>
+ authTokens;
+
+ std::chrono::time_point<std::chrono::steady_clock> lastTimeoutUpdate;
+ bool needWrite{false};
+ std::chrono::seconds timeoutInSeconds;
+ AuthConfigMethods authMethodsConfig;
+
+ private:
+ SessionStore() : timeoutInSeconds(3600)
+ {}
};
} // namespace persistent_data