sessions.hpp (3bf4e63296f0b69201904b03b2470543a7e0c627) sessions.hpp (1214b7e7d921e331fb1480c7e5d579ffa5811cda)
1#pragma once
2
1#pragma once
2
3#include "logging.h"
4#include "utility.h"
5
3#include <openssl/rand.h>
4
5#include <boost/container/flat_map.hpp>
6#include <boost/uuid/uuid.hpp>
7#include <boost/uuid/uuid_generators.hpp>
8#include <boost/uuid/uuid_io.hpp>
6#include <openssl/rand.h>
7
8#include <boost/container/flat_map.hpp>
9#include <boost/uuid/uuid.hpp>
10#include <boost/uuid/uuid_generators.hpp>
11#include <boost/uuid/uuid_io.hpp>
9#include <csignal>
10#include <dbus_singleton.hpp>
11#include <nlohmann/json.hpp>
12#include <pam_authenticate.hpp>
12#include <dbus_singleton.hpp>
13#include <nlohmann/json.hpp>
14#include <pam_authenticate.hpp>
13#include <random>
14#include <sdbusplus/bus/match.hpp>
15
15#include <sdbusplus/bus/match.hpp>
16
16#include "logging.h"
17#include "utility.h"
17#include <csignal>
18#include <random>
18#ifdef BMCWEB_ENABLE_IBM_MANAGEMENT_CONSOLE
19#include <ibm/locks.hpp>
20#endif
21
22namespace crow
23{
24
25namespace persistent_data

--- 335 unchanged lines hidden (view full) ---

361 return sessionStore;
362 }
363
364 SessionStore(const SessionStore&) = delete;
365 SessionStore& operator=(const SessionStore&) = delete;
366
367 private:
368 SessionStore() : timeoutInMinutes(60)
19#ifdef BMCWEB_ENABLE_IBM_MANAGEMENT_CONSOLE
20#include <ibm/locks.hpp>
21#endif
22
23namespace crow
24{
25
26namespace persistent_data

--- 335 unchanged lines hidden (view full) ---

362 return sessionStore;
363 }
364
365 SessionStore(const SessionStore&) = delete;
366 SessionStore& operator=(const SessionStore&) = delete;
367
368 private:
369 SessionStore() : timeoutInMinutes(60)
369 {
370 }
370 {}
371
372 void applySessionTimeouts()
373 {
374 auto timeNow = std::chrono::steady_clock::now();
375 if (timeNow - lastTimeoutUpdate > std::chrono::minutes(1))
376 {
377 lastTimeoutUpdate = timeNow;
378 auto authTokensIt = authTokens.begin();

--- 47 unchanged lines hidden (view full) ---

426 j = nlohmann::json{{"unique_id", p->uniqueId},
427 {"session_token", p->sessionToken},
428 {"username", p->username},
429 {"csrf_token", p->csrfToken}};
430 }
431 }
432};
433
371
372 void applySessionTimeouts()
373 {
374 auto timeNow = std::chrono::steady_clock::now();
375 if (timeNow - lastTimeoutUpdate > std::chrono::minutes(1))
376 {
377 lastTimeoutUpdate = timeNow;
378 auto authTokensIt = authTokens.begin();

--- 47 unchanged lines hidden (view full) ---

426 j = nlohmann::json{{"unique_id", p->uniqueId},
427 {"session_token", p->sessionToken},
428 {"username", p->username},
429 {"csrf_token", p->csrfToken}};
430 }
431 }
432};
433
434template <> struct adl_serializer<crow::persistent_data::AuthConfigMethods>
434template <>
435struct adl_serializer<crow::persistent_data::AuthConfigMethods>
435{
436 static void to_json(nlohmann::json& j,
437 const crow::persistent_data::AuthConfigMethods& c)
438 {
439 j = nlohmann::json{{"XToken", c.xtoken},
440 {"Cookie", c.cookie},
441 {"SessionToken", c.sessionToken},
442 {"BasicAuth", c.basic},
443 {"TLS", c.tls}};
444 }
445};
446} // namespace nlohmann
436{
437 static void to_json(nlohmann::json& j,
438 const crow::persistent_data::AuthConfigMethods& c)
439 {
440 j = nlohmann::json{{"XToken", c.xtoken},
441 {"Cookie", c.cookie},
442 {"SessionToken", c.sessionToken},
443 {"BasicAuth", c.basic},
444 {"TLS", c.tls}};
445 }
446};
447} // namespace nlohmann