WIP. User authentication on user interface

This commit is contained in:
emeric
2014-07-08 19:39:49 +02:00
parent 4744111959
commit 3e96534e08
17 changed files with 370 additions and 76 deletions
+2 -2
View File
@@ -18,11 +18,11 @@ namespace Server {
Connection::Connection(boost::asio::io_service& ioService,
boost::asio::ssl::context& context,
ConnectionManager& manager,
RequestHandler& handler)
const boost::filesystem::path& dbPath)
: _closing(false),
_socket(ioService, context),
_connectionManager(manager),
_requestHandler(handler)
_requestHandler(dbPath)
{
std::cout << "Server::Connection::Connection, Creating connection" << std::endl;
}
+3 -2
View File
@@ -30,7 +30,8 @@ class Connection : public std::enable_shared_from_this<Connection>
/// Construct a connection with the given io_service.
explicit Connection(boost::asio::io_service& ioService, boost::asio::ssl::context& context,
ConnectionManager& manager, RequestHandler& handler);
ConnectionManager& manager,
const boost::filesystem::path& dbPath);
ssl_socket::lowest_layer_type& getSocket() {return _socket.lowest_layer();}
@@ -63,7 +64,7 @@ class Connection : public std::enable_shared_from_this<Connection>
ConnectionManager& _connectionManager;
/// The handler used to process the incoming requests.
RequestHandler& _requestHandler;
RequestHandler _requestHandler;
boost::asio::streambuf _inputStreamBuf;
boost::asio::streambuf _outputStreamBuf;
+2 -2
View File
@@ -15,7 +15,7 @@ _ioService(ioService),
_acceptor(_ioService, bindEndpoint, true /*SO_REUSEADDR*/),
_connectionManager(),
_context(boost::asio::ssl::context::tlsv1_server),
_requestHandler(dbPath)
_dbPath(dbPath)
{
_context.set_options( boost::asio::ssl::context::default_workarounds // TODO check this thing
| boost::asio::ssl::context::single_dh_use
@@ -40,7 +40,7 @@ Server::run()
void
Server::asyncAccept()
{
std::shared_ptr<Connection> newConnection = std::make_shared<Connection>(_ioService, _context, _connectionManager, _requestHandler);
std::shared_ptr<Connection> newConnection = std::make_shared<Connection>(_ioService, _context, _connectionManager, _dbPath);
_acceptor.async_accept(newConnection->getSocket(),
boost::bind(&Server::handleAccept, this, newConnection, boost::asio::placeholders::error));
+2 -2
View File
@@ -46,8 +46,8 @@ class Server
boost::asio::ssl::context _context;
/// The handler for all incoming requests.
RequestHandler _requestHandler;
/// The database to be used for requests
boost::filesystem::path _dbPath;
};
} // namespace Server