summaryrefslogtreecommitdiff
path: root/ACE/TAO/orbsvcs/tests/Security/mixed_security_test/Foo_i.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/TAO/orbsvcs/tests/Security/mixed_security_test/Foo_i.cpp')
-rw-r--r--ACE/TAO/orbsvcs/tests/Security/mixed_security_test/Foo_i.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/ACE/TAO/orbsvcs/tests/Security/mixed_security_test/Foo_i.cpp b/ACE/TAO/orbsvcs/tests/Security/mixed_security_test/Foo_i.cpp
new file mode 100644
index 00000000000..aa1368d5e67
--- /dev/null
+++ b/ACE/TAO/orbsvcs/tests/Security/mixed_security_test/Foo_i.cpp
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+
+#include "Foo_i.h"
+
+#include "ace/OS_NS_string.h"
+
+
+ACE_RCSID (Secure_Invocation,
+ Foo_i,
+ "$Id$")
+
+
+Foo_i::Foo_i (CORBA::ORB_ptr orb,
+ SecurityLevel3::SecurityCurrent_ptr current)
+ : orb_ (CORBA::ORB::_duplicate (orb)),
+ current_ (SecurityLevel3::SecurityCurrent::_duplicate (current))
+{
+}
+
+void
+Foo_i::baz (void)
+{
+ if (this->current_.in() == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "FOO (%P|%t) No ClientCredentials available\n"));
+ return;
+ }
+
+ try
+ {
+ SecurityLevel3::ClientCredentials_var credentials =
+ this->current_->client_credentials ();
+
+ CORBA::String_var id = credentials->creds_id ();
+
+ ACE_DEBUG ((LM_DEBUG,
+ "FOO (%P|%t) ClientCredentials ID: %s\n", id.in ()));
+ return;
+ }
+ catch (const CORBA::BAD_INV_ORDER &ex)
+ {
+ ACE_DEBUG ((LM_INFO,
+ "FOO (%P|%t) Caught BAD_INV_ORDER exception trying to obtain "
+ "client credentials. This is okay if the invocation was via "
+ "non-secured means.\n"));
+ ex._tao_print_exception ("obtaining client credentials");
+ // should we re-throw? No, because what we're testing is whether
+ // we go into this method, not whether the method itself operates
+ // properly.
+ }
+ catch (CORBA::Exception& ex)
+ {
+ ACE_DEBUG ((LM_ERROR, "FOO (%P|%t) Caught exception, trying to obtain ClientCredentials"));
+ ex._tao_print_exception ("Exception");
+ }
+
+}
+
+void
+Foo_i::shutdown (void)
+{
+ this->orb_->shutdown (0);
+}