summaryrefslogtreecommitdiff
path: root/cpp/examples/qmf-agent/example.cpp
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2010-11-09 21:15:03 +0000
committerTed Ross <tross@apache.org>2010-11-09 21:15:03 +0000
commit4870a01b7976362d3836ba0d56291f01b7f2e6af (patch)
tree921b002956ec18c7fe5602b0641e9dd8395b7f98 /cpp/examples/qmf-agent/example.cpp
parentd282da7e6f515ded59a76b4dfbc2bedab8f7f6d7 (diff)
downloadqpid-python-4870a01b7976362d3836ba0d56291f01b7f2e6af.tar.gz
QPID-2934 Feature to pass the authenticated userId to QMF agent method handlers for authorization
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1033232 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/examples/qmf-agent/example.cpp')
-rw-r--r--cpp/examples/qmf-agent/example.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/cpp/examples/qmf-agent/example.cpp b/cpp/examples/qmf-agent/example.cpp
index b432c2a065..f9be4f0164 100644
--- a/cpp/examples/qmf-agent/example.cpp
+++ b/cpp/examples/qmf-agent/example.cpp
@@ -24,6 +24,7 @@
#include <qpid/agent/ManagementAgent.h>
#include <qpid/sys/Mutex.h>
#include <qpid/sys/Time.h>
+#include <qpid/log/Statement.h>
#include "qpid/types/Variant.h"
#include "qmf/org/apache/qpid/agent/example/Parent.h"
#include "qmf/org/apache/qpid/agent/example/Child.h"
@@ -72,7 +73,8 @@ public:
{ return mgmtObject; }
void doLoop();
- status_t ManagementMethod (uint32_t methodId, Args& args, string& text);
+ bool AuthorizeMethod(uint32_t methodId, Args& args, const string& userId);
+ status_t ManagementMethod(uint32_t methodId, Args& args, string& text);
};
class ChildClass : public Manageable
@@ -137,6 +139,14 @@ void CoreClass::doLoop()
}
}
+
+bool CoreClass::AuthorizeMethod(uint32_t methodId, Args& args, const string& userId)
+{
+ QPID_LOG(trace, "AuthorizeMethod for methodId=" << methodId << " userId=" << userId);
+ return methodId != _qmf::Parent::METHOD_AUTH_FAIL;
+}
+
+
Manageable::status_t CoreClass::ManagementMethod(uint32_t methodId, Args& args, string& /*text*/)
{
Mutex::ScopedLock _lock(vectorLock);