From 42d18e5791c0f79588d5264f2b0c96ee0a39c122 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Tue, 9 Nov 2010 21:15:03 +0000 Subject: 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@1033232 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/examples/qmf-agent/example.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'qpid/cpp/examples/qmf-agent/example.cpp') diff --git a/qpid/cpp/examples/qmf-agent/example.cpp b/qpid/cpp/examples/qmf-agent/example.cpp index b432c2a065..f9be4f0164 100644 --- a/qpid/cpp/examples/qmf-agent/example.cpp +++ b/qpid/cpp/examples/qmf-agent/example.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #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); -- cgit v1.2.1