00001 // -*- C++ -*- 00002 00003 #include "orbsvcs/Security/Security_Current.h" 00004 #include "tao/debug.h" 00005 00006 ACE_RCSID (Security, 00007 Security_Current, 00008 "$Id: Security_Current.cpp 77001 2007-02-12 07:54:49Z johnnyw $") 00009 00010 #if !defined (__ACE_INLINE__) 00011 # include "orbsvcs/Security/Security_Current.inl" 00012 #endif /* __ACE_INLINE__ */ 00013 00014 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00015 00016 TAO_Security_Current::TAO_Security_Current (size_t tss_slot, 00017 const char *orb_id) 00018 : tss_slot_ (tss_slot), 00019 orb_id_ (orb_id), 00020 orb_core_ (0) 00021 { 00022 } 00023 00024 TAO_Security_Current::~TAO_Security_Current (void) 00025 { 00026 } 00027 00028 Security::AttributeList * 00029 TAO_Security_Current::get_attributes ( 00030 const Security::AttributeTypeList &attributes) 00031 { 00032 TAO::Security::Current_Impl *impl = this->implementation (); 00033 00034 // If the implementation pointer returned from TSS is zero, then 00035 // we're not in the middle of a request/upcall. Throw an exception 00036 // to indicate that. 00037 if (impl == 0) 00038 throw CORBA::BAD_INV_ORDER (); 00039 00040 return impl->get_attributes (attributes); 00041 } 00042 00043 SecurityLevel2::ReceivedCredentials_ptr 00044 TAO_Security_Current::received_credentials () 00045 { 00046 TAO::Security::Current_Impl *impl = this->implementation (); 00047 00048 // If the implementation pointer returned from TSS is zero, then 00049 // we're not in the middle of a request/upcall. Throw an exception 00050 // to indicate that. 00051 if (impl == 0) 00052 throw CORBA::BAD_INV_ORDER (); 00053 00054 return impl->received_credentials (); 00055 } 00056 00057 int 00058 TAO_Security_Current::init (void) 00059 { 00060 int result = 0; 00061 00062 try 00063 { 00064 int argc = 0; 00065 char **argv = 0; 00066 CORBA::ORB_var orb = CORBA::ORB_init (argc, 00067 argv, 00068 this->orb_id_.in ()); 00069 00070 this->orb_core_ = orb.in ()->orb_core (); 00071 00072 // No longer need the ORBid, so reclaim the memory it was 00073 // occupying. 00074 (void) this->orb_id_.out (); 00075 } 00076 catch (const CORBA::Exception& ex) 00077 { 00078 if (TAO_debug_level >= 1) 00079 ex._tao_print_exception ("Could not initialize SecurityCurrent:"); 00080 00081 result = -1; 00082 } 00083 00084 return result; 00085 } 00086 00087 TAO_END_VERSIONED_NAMESPACE_DECL