Myra Canyon  v0.0.1-768
network control
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Myra::Session Namespace Reference

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...
 

Detailed Description

Manage session IDs. Used by the Myra Apache module to determine if a user has correctly logged in.

Function Documentation

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.

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

bool Myra::Session::delete_session ( const std::string &  session_id)

Remove a session ID and immediately save to disk.

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

bool Myra::Session::is_valid_session ( const std::string &  session_id,
const std::string &  ip_address 
)

Validate a session id and source IP address.

Here is the call graph for this function:

Here is the caller graph for this function:

bool Myra::Session::is_valid_session ( const Json::Value root,
const std::string &  session_id,
const std::string &  ip_address 
)
Returns
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.

Here is the call graph for this function:

Here is the caller graph for this function:

bool Myra::Session::remove_expired_sessions ( Json::Value root)

Remove all exipred sessions.

Returns
true if 1 or more session was removed.

Here is the call graph for this function:

Here is the caller graph for this function:

void Myra::Session::write ( const Json::Value root)

Write all sessions.

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

const char *const Myra::Session::Filename = "/usr/share/myra/myra-session.json"

Filename where session IDs are stored.