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
commitc7dbd61e99e5f8164cfbcc35e06b65ef92e7eee4 (patch)
tree921b002956ec18c7fe5602b0641e9dd8395b7f98 /cpp/examples/qmf-agent/example.cpp
parent985cd34247ff623cca05d65ecd67725cafb3cb2f (diff)
downloadqpid-python-c7dbd61e99e5f8164cfbcc35e06b65ef92e7eee4.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);