From df826cf6ab76c434904811eb38c2258c278d7872 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Tue, 22 Sep 2009 18:58:59 +0000 Subject: QPID-2112 - C++ Client: Facility needed for app to extract the user-ID in use for a connection git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@817770 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/SaslFactory.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'cpp/src/qpid/client/SaslFactory.cpp') diff --git a/cpp/src/qpid/client/SaslFactory.cpp b/cpp/src/qpid/client/SaslFactory.cpp index 884f527f01..6d22943deb 100644 --- a/cpp/src/qpid/client/SaslFactory.cpp +++ b/cpp/src/qpid/client/SaslFactory.cpp @@ -82,6 +82,7 @@ class CyrusSasl : public Sasl std::string start(const std::string& mechanisms); std::string step(const std::string& challenge); std::string getMechanism(); + std::string getUserId(); std::auto_ptr getSecurityLayer(uint16_t maxFrameSize); private: sasl_conn_t* conn; @@ -266,6 +267,18 @@ std::string CyrusSasl::getMechanism() return mechanism; } +std::string CyrusSasl::getUserId() +{ + int propResult; + const char* operName; + + propResult = sasl_getprop(conn, SASL_USERNAME, (const void**) &operName); + if (propResult == SASL_OK) + return std::string(operName); + + return std::string(); +} + void CyrusSasl::interact(sasl_interact_t* client_interact) { -- cgit v1.2.1