diff options
author | Gordon Sim <gsim@apache.org> | 2008-10-21 22:59:47 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2008-10-21 22:59:47 +0000 |
commit | 2da66c9b0a5b3acd90049ee633d2ad557a080ec4 (patch) | |
tree | c66443da92f65921e88eb7ea3a7ba47513593ddc /qpid/cpp/src | |
parent | ab825dbeb7c31f79c11c073189eef9f869757bbb (diff) | |
download | qpid-python-2da66c9b0a5b3acd90049ee633d2ad557a080ec4.tar.gz |
Qualify userid with realm when authentication is turned off
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@706806 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r-- | qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp b/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp index d0e0d5bead..1f9bd9c576 100644 --- a/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp +++ b/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp @@ -26,12 +26,15 @@ #include "Connection.h" #include "qpid/log/Statement.h" #include "qpid/framing/reply_exceptions.h" +#include <boost/format.hpp> #if HAVE_SASL #include <sasl/sasl.h> #endif using namespace qpid::framing; +using boost::format; +using boost::str; namespace qpid { namespace broker { @@ -41,6 +44,7 @@ class NullAuthenticator : public SaslAuthenticator { Connection& connection; framing::AMQP_ClientProxy::Connection client; + std::string realm; public: NullAuthenticator(Connection& connection); ~NullAuthenticator(); @@ -119,7 +123,8 @@ std::auto_ptr<SaslAuthenticator> SaslAuthenticator::createAuthenticator(Connecti } } -NullAuthenticator::NullAuthenticator(Connection& c) : connection(c), client(c.getOutput()) {} +NullAuthenticator::NullAuthenticator(Connection& c) : connection(c), client(c.getOutput()), + realm(c.getBroker().getOptions().realm) {} NullAuthenticator::~NullAuthenticator() {} void NullAuthenticator::getMechanisms(Array& mechanisms) @@ -136,7 +141,7 @@ void NullAuthenticator::start(const string& mechanism, const string& response) string::size_type i = temp.find((char)0); string uid = temp.substr(0, i); string pwd = temp.substr(i + 1); - connection.setUserId(uid); + connection.setUserId(str(format("%1%@%2%") % uid % realm)); } } else { connection.setUserId("anonymous"); |