summaryrefslogtreecommitdiffstats
path: root/src/Server/ConnectionManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Server/ConnectionManager.h')
-rw-r--r--src/Server/ConnectionManager.h27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/Server/ConnectionManager.h b/src/Server/ConnectionManager.h
index bdf1b4d..e045a6a 100644
--- a/src/Server/ConnectionManager.h
+++ b/src/Server/ConnectionManager.h
@@ -24,6 +24,7 @@
#include <Core/Configurable.h>
#include <Core/Exception.h>
+#include <Common/AuthContext.h>
#include <Common/Connection.h>
#include <Common/HostInfo.h>
#include <Common/RequestHandlerGroup.h>
@@ -49,22 +50,25 @@ class Application;
class MAD_SERVER_EXPORT ConnectionManager : public Core::Configurable, private boost::noncopyable {
private:
- class ServerConnection : public Common::Connection {
+ class MAD_SERVER_EXPORT ServerConnection : public Common::Connection {
public:
enum ConnectionType {
UNKNOWN = 0, DAEMON, CLIENT
};
private:
+ Common::Application *application;
+
boost::shared_ptr<Net::Connection> connection;
ConnectionType type;
Common::HostInfo *hostInfo;
+ boost::shared_ptr<Common::AuthContext> authContext;
protected:
virtual bool send(const Net::Packet &packet);
public:
- ServerConnection(Core::Application *application, boost::shared_ptr<Net::Connection> connection0);
+ ServerConnection(Common::Application *application0, boost::shared_ptr<Net::Connection> connection0);
bool isConnected() const;
@@ -92,6 +96,13 @@ class MAD_SERVER_EXPORT ConnectionManager : public Core::Configurable, private b
type = DAEMON;
hostInfo = info;
}
+
+ bool isAuthenticated() const {
+ return (authContext.get() != 0 && authContext->isAuthenticated());
+ }
+
+ boost::shared_ptr<const Common::AuthContext> authenticate(const std::string &method, const std::string &user,
+ const std::vector<boost::uint8_t> &challenge, std::vector<boost::uint8_t> &response);
};
friend class Application;
@@ -126,11 +137,15 @@ class MAD_SERVER_EXPORT ConnectionManager : public Core::Configurable, private b
virtual void configFinished();
public:
- boost::shared_ptr<Common::Connection> getDaemonConnection(const std::string &name) const throw (Core::Exception&);
- std::string getDaemonName(const Common::Connection *con) const throw (Core::Exception&);
+ boost::shared_ptr<Common::Connection> getDaemonConnection(const std::string &name) const throw (Core::Exception);
+ std::string getDaemonName(const Common::Connection *con) const throw (Core::Exception);
+
+ void identifyDaemonConnection(Common::Connection *con, const std::string &name) throw (Core::Exception);
+
+ boost::shared_ptr<const Common::AuthContext> authenticateConnection(Common::Connection *con, const std::string &method,
+ const std::string &user, const std::vector<boost::uint8_t> &challenge, std::vector<boost::uint8_t> &response);
- void identifyDaemonConnection(Common::Connection *con, const std::string &name) throw (Core::Exception&);
- void identifyClientConnection(Common::Connection *con) throw (Core::Exception&);
+ bool isAuthenticated(Common::Connection *con) const;
std::vector<Common::HostInfo> getDaemonList() const;
};