Manage session IDs. Used by the Myra Apache module to determine if a user has correctly logged in. More...
Functions | |
bool | remove_expired_sessions (Json::Value &root) |
Remove all exipred sessions. More... | |
Json::Value | read (void) |
Load all sessions. More... | |
void | write (const Json::Value &root) |
Write all sessions. More... | |
std::string | create_new_session (const std::string &username, const std::string &ip_address) |
Create a new session ID and immediately save to disk. More... | |
std::string | create_new_session (Json::Value &root, const std::string &username, const std::string &ip_address) |
Create a new session. The sessions are not saved to disk. Remember to call write(). More... | |
bool | delete_session (const std::string &session_id) |
Remove a session ID and immediately save to disk. More... | |
bool | delete_session (Json::Value &root, const std::string &session_id) |
Remove a session. This sessions are not saved to disk. Remember to call write(). More... | |
bool | is_valid_session (const std::string &session_id, const std::string &ip_address) |
Validate a session id and source IP address. More... | |
bool | is_valid_session (const Json::Value &root, const std::string &session_id, const std::string &ip_address) |
Variables | |
const char *const | Filename = "/usr/share/myra/myra-session.json" |
Filename where session IDs are stored. More... | |
Manage session IDs. Used by the Myra Apache module to determine if a user has correctly logged in.
std::string Myra::Session::create_new_session | ( | const std::string & | username, |
const std::string & | ip_address | ||
) |
Create a new session ID and immediately save to disk.
std::string Myra::Session::create_new_session | ( | Json::Value & | root, |
const std::string & | username, | ||
const std::string & | ip_address | ||
) |
Create a new session. The sessions are not saved to disk. Remember to call write().
bool Myra::Session::delete_session | ( | const std::string & | session_id | ) |
Remove a session ID and immediately save to disk.
bool Myra::Session::delete_session | ( | Json::Value & | root, |
const std::string & | session_id | ||
) |
Remove a session. This sessions are not saved to disk. Remember to call write().
bool Myra::Session::is_valid_session | ( | const std::string & | session_id, |
const std::string & | ip_address | ||
) |
Validate a session id and source IP address.
bool Myra::Session::is_valid_session | ( | const Json::Value & | root, |
const std::string & | session_id, | ||
const std::string & | ip_address | ||
) |
false
if the session id is invalid, or if the IP address doesn't match.true
if the session is valid and the IP address matches. Json::Value Myra::Session::read | ( | void | ) |
Load all sessions.
bool Myra::Session::remove_expired_sessions | ( | Json::Value & | root | ) |
Remove all exipred sessions.
true
if 1 or more session was removed. void Myra::Session::write | ( | const Json::Value & | root | ) |
Write all sessions.
const char *const Myra::Session::Filename = "/usr/share/myra/myra-session.json" |
Filename where session IDs are stored.