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 | a0071999a69d016521527e36b4d3b1d52c5eb553 (patch) | |
tree | 7ef988dd9ca8c5c93985dd4f7c031fe00980fd0a /cpp/src | |
parent | bcc3455b20ffbcefd40230e8fa2c8b6137cda321 (diff) | |
download | qpid-python-a0071999a69d016521527e36b4d3b1d52c5eb553.tar.gz |
Qualify userid with realm when authentication is turned off
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@706806 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/broker/SaslAuthenticator.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cpp/src/qpid/broker/SaslAuthenticator.cpp b/cpp/src/qpid/broker/SaslAuthenticator.cpp index d0e0d5bead..1f9bd9c576 100644 --- a/cpp/src/qpid/broker/SaslAuthenticator.cpp +++ b/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"); |