diff options
author | Benoit Foucher <benoit@zeroc.com> | 2012-11-14 11:45:12 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2012-11-14 11:45:12 +0100 |
commit | 571ac01744defba69021292d58767002876a0de6 (patch) | |
tree | b6cb8ccca5539232f5e301b4e24703be5ce6fdf1 /cpp/test/IceGrid/session/Server.cpp | |
parent | Fixed IceGrid locator implementation to check for the client encoding (diff) | |
download | ice-571ac01744defba69021292d58767002876a0de6.tar.bz2 ice-571ac01744defba69021292d58767002876a0de6.tar.xz ice-571ac01744defba69021292d58767002876a0de6.zip |
Fixed ICE-4941: Improved Glacier2 permission verifier to allow them to throw PermissionDeniedException
Diffstat (limited to 'cpp/test/IceGrid/session/Server.cpp')
-rw-r--r-- | cpp/test/IceGrid/session/Server.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/cpp/test/IceGrid/session/Server.cpp b/cpp/test/IceGrid/session/Server.cpp index 5386c861039..9612ca67d65 100644 --- a/cpp/test/IceGrid/session/Server.cpp +++ b/cpp/test/IceGrid/session/Server.cpp @@ -11,6 +11,7 @@ #include <Glacier2/PermissionsVerifier.h> #include <IceSSL/Plugin.h> #include <TestCommon.h> +#include <Test.h> using namespace std; @@ -19,8 +20,12 @@ class ClientPermissionsVerifierI : public Glacier2::PermissionsVerifier public: virtual bool - checkPermissions(const string& userId, const string& passwd, string&, const Ice::Current&) const + checkPermissions(const string& userId, const string& passwd, string&, const Ice::Current& current) const { + if(current.ctx.find("throw") != current.ctx.end()) + { + throw Test::ExtendedPermissionDeniedException("reason"); + } return (userId == "client1" && passwd == "test1") || (userId == "client2" && passwd == "test2"); } }; @@ -32,6 +37,11 @@ public: virtual bool authorize(const Glacier2::SSLInfo& info, string&, const Ice::Current& current) const { + if(current.ctx.find("throw") != current.ctx.end()) + { + throw Test::ExtendedPermissionDeniedException("reason"); + } + IceSSL::CertificatePtr cert = IceSSL::Certificate::decode(info.certs[0]); test(cert->getIssuerDN() == IceSSL::DistinguishedName( "emailAddress=info@zeroc.com,CN=ZeroC Test CA,OU=Ice,O=ZeroC\\, Inc.,L=Palm Beach Gardens," |