Security_ORBInitializer.cpp File Reference

#include "orbsvcs/Security/Security_ORBInitializer.h"
#include "orbsvcs/Security/Security_Current.h"
#include "orbsvcs/Security/SL2_SecurityManager.h"
#include "orbsvcs/Security/SL3_SecurityCurrent.h"
#include "orbsvcs/Security/SL3_CredentialsCurator.h"
#include "orbsvcs/Security/SL3_SecurityManager.h"
#include "orbsvcs/SecurityC.h"
#include "tao/PI/ORBInitInfo.h"
#include "tao/ORB_Constants.h"
#include "tao/debug.h"

Include dependency graph for Security_ORBInitializer.cpp:

Include dependency graph

Go to the source code of this file.

Functions

 ACE_RCSID (Security, Security_ORBInitializer,"$Id:Security_ORBInitializer.cpp 79586 2007-09-06 09:25:00Z johnnyw $") TAO_BEGIN_VERSIONED_NAMESPACE_DECL void TAO


Function Documentation

ACE_RCSID Security  ,
Security_ORBInitializer  ,
"$Id:Security_ORBInitializer.cpp 79586 2007-09-06 09:25:00Z johnnyw $" 
 

Definition at line 5 of file Security_ORBInitializer.cpp.

References ACE_ERROR, ACE_NEW_THROW_EX, CORBA::is_nil(), LM_ERROR, CORBA::Object::orb_core(), TAO_BEGIN_VERSIONED_NAMESPACE_DECL, and TAO_debug_level.

00007                : Security_ORBInitializer.cpp 79586 2007-09-06 09:25:00Z johnnyw $")
00008 
00009 
00010 #if 1
00011 #include "orbsvcs/Security/Security_Current.h"
00012 #include "orbsvcs/Security/SL2_SecurityManager.h"
00013 #endif
00014 #include "orbsvcs/Security/SL3_SecurityCurrent.h"
00015 #include "orbsvcs/Security/SL3_CredentialsCurator.h"
00016 #include "orbsvcs/Security/SL3_SecurityManager.h"
00017 
00018 #include "orbsvcs/SecurityC.h"
00019 
00020 #include "tao/PI/ORBInitInfo.h"
00021 #include "tao/ORB_Constants.h"
00022 #include "tao/debug.h"
00023 
00024 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00025 
00026 void
00027 TAO::Security::ORBInitializer::pre_init (
00028     PortableInterceptor::ORBInitInfo_ptr info)
00029 {
00030   // Narrow to a TAO_ORBInitInfo object to get access to the
00031   // allocate_tss_slot_id() TAO extension.
00032   TAO_ORBInitInfo_var tao_info =
00033     TAO_ORBInitInfo::_narrow (info);
00034 
00035   if (CORBA::is_nil (tao_info.in ()))
00036     {
00037       if (TAO_debug_level > 0)
00038         ACE_ERROR ((LM_ERROR,
00039                     "(%P|%t) Security_ORBInitializer::pre_init:\n"
00040                     "(%P|%t)    Unable to narrow "
00041                     "\"PortableInterceptor::ORBInitInfo_ptr\" to\n"
00042                     "(%P|%t)   \"TAO_ORBInitInfo_ptr.\"\n"));
00043 
00044       throw CORBA::INTERNAL ();
00045     }
00046 
00047   // Reserve a TSS slot in the ORB core internal TSS resources for the
00048   // thread-specific portion of Security::Current.
00049   size_t tss_slot = tao_info->allocate_tss_slot_id (0 /* no cleanup function */);
00050 
00051 #if 1
00052 
00053 #if 0 // why am I getting a BAD_OPERATION from no SSL context?!
00054   CORBA::String_var orb_id = info->orb_id ();
00055 
00056   // Create the SecurityLevel2::Current object.
00057   SecurityLevel2::Current_ptr current = SecurityLevel2::Current::_nil ();
00058   ACE_NEW_THROW_EX (current,
00059                     TAO_Security_Current (tss_slot, orb_id.in ()),
00060                     CORBA::NO_MEMORY (
00061                                       CORBA::SystemException::_tao_minor_code (
00062                          TAO::VMCID,
00063                          ENOMEM),
00064                        CORBA::COMPLETED_NO));
00065 
00066   SecurityLevel2::Current_var security_current = current;
00067 
00068   // Register the SecurityLevel2::Current object reference with the
00069   // ORB.
00070   info->register_initial_reference ("SecurityCurrent",
00071                                     security_current.in ());
00072 #endif
00073   /*
00074    * Instantiate and register the SecurityLevel2::SecurityManager
00075    */
00076   SecurityLevel2::SecurityManager_ptr manager2;
00077   ACE_NEW_THROW_EX (manager2,
00078                     TAO::Security::SecurityManager (/*need args*/),
00079                     CORBA::NO_MEMORY (
00080                       CORBA::SystemException::_tao_minor_code (
00081                         TAO::VMCID,
00082                         ENOMEM),
00083                       CORBA::COMPLETED_NO));
00084 
00085   SecurityLevel2::SecurityManager_var security_manager2 = manager2;
00086 
00087   // Register the SecurityLevel2::SecurityManager object reference
00088   // with the ORB.
00089   info->register_initial_reference ("SecurityLevel2:SecurityManager",
00090                                     security_manager2.in ());
00091 
00092 #endif
00093 
00094   // Rather than reserve another TSS slot in the ORB core internal TSS
00095   // resources for the thread-specific portion of
00096   // SecurityLevel3::SecurityCurrent object, we will re-use the slot
00097   // allocated earlier.
00098 
00099   // Create the SecurityLevel3::Current object.
00100   SecurityLevel3::SecurityCurrent_ptr current3;
00101   ACE_NEW_THROW_EX (current3,
00102                     TAO::SL3::SecurityCurrent (tss_slot,
00103                                                tao_info->orb_core ()),
00104                     CORBA::NO_MEMORY (
00105                       CORBA::SystemException::_tao_minor_code (
00106                         TAO::VMCID,
00107                         ENOMEM),
00108                       CORBA::COMPLETED_NO));
00109 
00110   SecurityLevel3::SecurityCurrent_var security_current3 = current3;
00111 
00112   // Register the SecurityLevel2::Current object reference with the
00113   // ORB.
00114   info->register_initial_reference ("SecurityLevel3:SecurityCurrent",
00115                                     security_current3.in ());
00116 
00117   // Create the SecurityLevel3::CredentialsCurator object.
00118   SecurityLevel3::CredentialsCurator_ptr curator;
00119   ACE_NEW_THROW_EX (curator,
00120                     TAO::SL3::CredentialsCurator,
00121                     CORBA::NO_MEMORY (
00122                       CORBA::SystemException::_tao_minor_code (
00123                         TAO::VMCID,
00124                         ENOMEM),
00125                       CORBA::COMPLETED_NO));
00126 
00127   SecurityLevel3::CredentialsCurator_var credentials_curator = curator;
00128 
00129   // Register the SecurityLevel3::CredentialsCurator object reference
00130   // with the ORB.
00131   info->register_initial_reference ("SecurityLevel3:CredentialsCurator",
00132                                     credentials_curator.in ());
00133 
00134   // Create the SecurityLevel3::SecurityManager object.
00135   SecurityLevel3::SecurityManager_ptr manager3;
00136   ACE_NEW_THROW_EX (manager3,
00137                     TAO::SL3::SecurityManager (credentials_curator.in ()),
00138                     CORBA::NO_MEMORY (
00139                       CORBA::SystemException::_tao_minor_code (
00140                         TAO::VMCID,
00141                         ENOMEM),
00142                       CORBA::COMPLETED_NO));
00143 
00144   SecurityLevel3::SecurityManager_var security_manager3 = manager3;
00145 
00146   // Register the SecurityLevel3::SecurityManager object reference
00147   // with the ORB.
00148   info->register_initial_reference ("SecurityLevel3:SecurityManager",
00149                                     security_manager3.in ());
00150 }


Generated on Sun Jan 27 16:09:45 2008 for TAO_Security by doxygen 1.3.6