diff options
| author | Ted Ross <tross@apache.org> | 2009-09-22 18:58:59 +0000 |
|---|---|---|
| committer | Ted Ross <tross@apache.org> | 2009-09-22 18:58:59 +0000 |
| commit | df826cf6ab76c434904811eb38c2258c278d7872 (patch) | |
| tree | e922dd983bd06439ed211ff085007774ec016f7e /cpp/src/qpid/client/SaslFactory.cpp | |
| parent | 3c1145e1d9fe5499f305e076e6ab48413e272d9a (diff) | |
| download | qpid-python-df826cf6ab76c434904811eb38c2258c278d7872.tar.gz | |
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
Diffstat (limited to 'cpp/src/qpid/client/SaslFactory.cpp')
| -rw-r--r-- | cpp/src/qpid/client/SaslFactory.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
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<SecurityLayer> 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) { |
