From c964aa2708ed2839ded3c35eed7338f3e81f568f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 24 Aug 2009 04:47:54 +0200 Subject: =?UTF-8?q?Authentifikation:=20=C3=9Cbertrage=20Passw=C3=B6rter=20?= =?UTF-8?q?gehasht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Server/ConnectionManager.cpp | 8 ++++---- src/Server/ConnectionManager.h | 6 +++--- .../RequestHandlers/ConnectionRequestHandlerGroup.cpp | 14 ++++++++++++-- 3 files changed, 19 insertions(+), 9 deletions(-) (limited to 'src/Server') diff --git a/src/Server/ConnectionManager.cpp b/src/Server/ConnectionManager.cpp index c49e7e8..b9490bc 100644 --- a/src/Server/ConnectionManager.cpp +++ b/src/Server/ConnectionManager.cpp @@ -58,11 +58,11 @@ bool ConnectionManager::ServerConnection::disconnect() { } boost::shared_ptr ConnectionManager::ServerConnection::authenticate(const std::string &method, - const std::string &user, const std::vector &data, std::vector &response) { + const std::string &subMethod, const std::string &user, const std::vector &data, std::vector &response) { if(!isIdentified()) type = CLIENT; - authContext = application->getAuthManager()->authenticate(method, user, data, response, authContext); + authContext = application->getAuthManager()->authenticate(method, subMethod, user, data, response, authContext); return authContext; } @@ -294,7 +294,7 @@ void ConnectionManager::identifyDaemonConnection(Common::Connection *con, const } boost::shared_ptr ConnectionManager::authenticateConnection(Common::Connection *con, const std::string &method, - const std::string &user, const std::vector &data, std::vector &response) { + const std::string &subMethod, const std::string &user, const std::vector &data, std::vector &response) { // TODO Logging ServerConnection *connection = dynamic_cast(con); @@ -305,7 +305,7 @@ boost::shared_ptr ConnectionManager::authenticateConn if(!connection->isIdentified()) connection->identify(); - return connection->authenticate(method, user, data, response); + return connection->authenticate(method, subMethod, user, data, response); } std::vector ConnectionManager::getDaemonList() const { diff --git a/src/Server/ConnectionManager.h b/src/Server/ConnectionManager.h index 067ce28..9638f38 100644 --- a/src/Server/ConnectionManager.h +++ b/src/Server/ConnectionManager.h @@ -101,8 +101,8 @@ class MAD_SERVER_EXPORT ConnectionManager : public Core::Configurable, private b return (authContext.get() != 0 && authContext->isAuthenticated()); } - boost::shared_ptr authenticate(const std::string &method, const std::string &user, - const std::vector &data, std::vector &response); + boost::shared_ptr authenticate(const std::string &method, const std::string &subMethod, + const std::string &user, const std::vector &data, std::vector &response); }; friend class Application; @@ -142,7 +142,7 @@ class MAD_SERVER_EXPORT ConnectionManager : public Core::Configurable, private b void identifyDaemonConnection(Common::Connection *con, const std::string &name) throw (Core::Exception); - boost::shared_ptr authenticateConnection(Common::Connection *con, const std::string &method, + boost::shared_ptr authenticateConnection(Common::Connection *con, const std::string &method, const std::string &subMethod, const std::string &user, const std::vector &data, std::vector &response); bool isAuthenticated(Common::Connection *con) const; diff --git a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp index 37e2e79..7607171 100644 --- a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp +++ b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp @@ -43,6 +43,15 @@ void ConnectionRequestHandlerGroup::handleAuthMethodRequest(boost::shared_ptraddEntry(); entry->set("name", *method); + Common::XmlPacket::List *subList = entry->createList("subMethods"); + + const std::vector &subMethods = application->getAuthManager()->getSubMethods(*method); + + for(std::vector::const_iterator subMethod = subMethods.begin(); subMethod != subMethods.end(); ++subMethod) { + Common::XmlPacket::List::iterator subEntry = subList->addEntry(); + + subEntry->set("name", *subMethod); + } } } @@ -50,8 +59,9 @@ void ConnectionRequestHandlerGroup::handleAuthRequest(boost::shared_ptr response; boost::shared_ptr authContext = application->getConnectionManager()->authenticateConnection(connection, - packet->get("method"), packet->get("user"), - packet->get&>("data"), response); + packet->get("method"), packet->get("subMethod"), + packet->get("user"), packet->get&>("data"), + response); if(!response.empty()) ret->set("data", response); -- cgit v1.2.3