Sirikata
|
#include <SQLiteAuthenticator.hpp>
Public Member Functions | |
SQLiteAuthenticator (SpaceContext *ctx, const String &dbfile, const String &select_stmt, const String &delete_stmt) | |
virtual | ~SQLiteAuthenticator () |
virtual void | start () |
virtual void | stop () |
virtual void | authenticate (const UUID &obj_id, MemoryReference auth, Callback cb) |
Try to authenticate a user given the requested object ID and associated authentication information. | |
Private Member Functions | |
bool | checkSQLiteError (int rc, const String &msg) const |
bool | checkTicket (const String &ticket) |
void | deleteTicket (const String &ticket) |
void | respond (Callback cb, bool result) |
Private Attributes | |
SpaceContext * | mContext |
String | mDBFile |
String | mDBGetSessionStmt |
String | mDBDeleteSessionStmt |
SQLiteDBPtr | mDB |
Sirikata::SQLiteAuthenticator::SQLiteAuthenticator | ( | SpaceContext * | ctx, |
const String & | dbfile, | ||
const String & | select_stmt, | ||
const String & | delete_stmt | ||
) |
virtual Sirikata::SQLiteAuthenticator::~SQLiteAuthenticator | ( | ) | [inline, virtual] |
void Sirikata::SQLiteAuthenticator::authenticate | ( | const UUID & | obj_id, |
MemoryReference | auth, | ||
Callback | cb | ||
) | [virtual] |
Try to authenticate a user given the requested object ID and associated authentication information.
The callback is invoked to provide the result, including failure due to timeout.
Implements Sirikata::Authenticator.
References checkTicket(), Sirikata::DataReference< T >::data(), deleteTicket(), mDB, respond(), and Sirikata::DataReference< T >::size().
bool Sirikata::SQLiteAuthenticator::checkSQLiteError | ( | int | rc, |
const String & | msg | ||
) | const [private] |
References Sirikata::SQLite::check_sql_error(), Sirikata::Logging::error, mDB, and SILOG.
Referenced by checkTicket(), and deleteTicket().
bool Sirikata::SQLiteAuthenticator::checkTicket | ( | const String & | ticket | ) | [private] |
References checkSQLiteError(), mDB, and mDBGetSessionStmt.
Referenced by authenticate().
void Sirikata::SQLiteAuthenticator::deleteTicket | ( | const String & | ticket | ) | [private] |
References checkSQLiteError(), mDB, and mDBDeleteSessionStmt.
Referenced by authenticate().
void Sirikata::SQLiteAuthenticator::respond | ( | Callback | cb, |
bool | result | ||
) | [private] |
References Sirikata::Context::mainStrand, mContext, and Sirikata::Network::IOStrand::post().
Referenced by authenticate().
void Sirikata::SQLiteAuthenticator::start | ( | ) | [virtual] |
Reimplemented from Sirikata::Authenticator.
References Sirikata::SQLite::getSingleton(), mDB, mDBFile, and Sirikata::SQLite::open().
void Sirikata::SQLiteAuthenticator::stop | ( | ) | [virtual] |
Reimplemented from Sirikata::Authenticator.
References mDB.
Referenced by respond().
Referenced by authenticate(), checkSQLiteError(), checkTicket(), deleteTicket(), start(), and stop().
String Sirikata::SQLiteAuthenticator::mDBDeleteSessionStmt [private] |
Referenced by deleteTicket().
String Sirikata::SQLiteAuthenticator::mDBFile [private] |
Referenced by start().
String Sirikata::SQLiteAuthenticator::mDBGetSessionStmt [private] |
Referenced by checkTicket().