From ccd271e851f2bc2b52a7c8daaa54a06551d63dc0 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Tue, 6 Jan 2009 19:50:59 +0000 Subject: * Cyrus SASL intgeration for c++ client * SASL security layer support for c++ client and broker git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@732082 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/ConnectionHandler.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'cpp/src/qpid/broker/ConnectionHandler.cpp') diff --git a/cpp/src/qpid/broker/ConnectionHandler.cpp b/cpp/src/qpid/broker/ConnectionHandler.cpp index 7386ce7229..6f99b60cd8 100644 --- a/cpp/src/qpid/broker/ConnectionHandler.cpp +++ b/cpp/src/qpid/broker/ConnectionHandler.cpp @@ -22,17 +22,20 @@ #include "ConnectionHandler.h" #include "Connection.h" +#include "SecureConnection.h" +#include "qpid/Url.h" #include "qpid/framing/ClientInvoker.h" #include "qpid/framing/ServerInvoker.h" #include "qpid/framing/enum.h" #include "qpid/log/Statement.h" -#include "qpid/Url.h" +#include "qpid/sys/SecurityLayer.h" #include "AclModule.h" #include "qmf/org/apache/qpid/broker/EventClientConnectFail.h" using namespace qpid; using namespace qpid::broker; using namespace qpid::framing; +using qpid::sys::SecurityLayer; namespace _qmf = qmf::org::apache::qpid::broker; namespace @@ -70,11 +73,16 @@ void ConnectionHandler::handle(framing::AMQFrame& frame) } } +void ConnectionHandler::setSecureConnection(SecureConnection* secured) +{ + handler->secured = secured; +} + ConnectionHandler::ConnectionHandler(Connection& connection, bool isClient) : handler(new Handler(connection, isClient)) {} ConnectionHandler::Handler::Handler(Connection& c, bool isClient) : client(c.getOutput()), server(c.getOutput()), - connection(c), serverMode(!isClient), acl(0) + connection(c), serverMode(!isClient), acl(0), secured(0) { if (serverMode) { @@ -160,6 +168,12 @@ void ConnectionHandler::Handler::open(const string& /*virtualHost*/, for (std::vector::iterator i = urls.begin(); i < urls.end(); ++i) array.add(boost::shared_ptr(new Str16Value(i->str()))); client.openOk(array); + + //install security layer if one has been negotiated: + if (secured) { + std::auto_ptr sl = authenticator->getSecurityLayer(connection.getFrameMax()); + if (sl.get()) secured->activateSecurityLayer(sl); + } } -- cgit v1.2.1