00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file SL3_CredentialsCurator.h 00006 * 00007 * SL3_CredentialsCurator.h,v 1.8 2006/06/21 13:53:07 parsons Exp 00008 * 00009 * @author Ossama Othman <ossama@dre.vanderbilt.edu> 00010 */ 00011 //============================================================================= 00012 00013 00014 #ifndef TAO_SL3_CREDENTIALS_CURATOR_H 00015 #define TAO_SL3_CREDENTIALS_CURATOR_H 00016 00017 #include /**/ "ace/pre.h" 00018 #include "orbsvcs/Security/security_export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "orbsvcs/SecurityLevel3C.h" 00025 00026 #include "tao/LocalObject.h" 00027 00028 #include "ace/Hash_Map_Manager_T.h" 00029 #include "ace/Map_Manager.h" 00030 00031 00032 #if defined(_MSC_VER) 00033 #pragma warning(push) 00034 #pragma warning(disable:4250) 00035 #endif /* _MSC_VER */ 00036 00037 00038 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00039 00040 namespace TAO 00041 { 00042 namespace SL3 00043 { 00044 class CredentialsAcquirerFactory; 00045 00046 class CredentialsCurator; 00047 typedef CredentialsCurator* CredentialsCurator_ptr; 00048 typedef TAO_Pseudo_Var_T<CredentialsCurator> CredentialsCurator_var; 00049 typedef TAO_Pseudo_Out_T<CredentialsCurator> CredentialsCurator_out; 00050 00051 /** 00052 * @class CredentialsCurator 00053 * 00054 * @brief Implementation of the SecurityLevel3::CredentialsCurator 00055 * object. 00056 * 00057 * This class provides a means for creating and managing 00058 * OwnCredentials. 00059 */ 00060 class TAO_Security_Export CredentialsCurator 00061 : public virtual SecurityLevel3::CredentialsCurator, 00062 public virtual TAO_Local_RefCounted_Object 00063 { 00064 public: 00065 typedef CredentialsCurator_ptr _ptr_type; 00066 typedef CredentialsCurator_var _var_type; 00067 typedef CredentialsCurator_out _out_type; 00068 00069 /** 00070 * The type of table that maps acquisition method to acquirer 00071 * factory. 00072 */ 00073 typedef ACE_Map_Manager<const char *, 00074 TAO::SL3::CredentialsAcquirerFactory *, 00075 ACE_Null_Mutex> Acquirer_Factory_Table; 00076 typedef Acquirer_Factory_Table::iterator Factory_Iterator; 00077 00078 typedef ACE_Hash_Map_Manager_Ex <const char *, 00079 SecurityLevel3::OwnCredentials_var, 00080 ACE_Hash<const char *>, 00081 ACE_Equal_To<const char *>, 00082 ACE_Null_Mutex> Credentials_Table; 00083 typedef Credentials_Table::iterator Credentials_Iterator; 00084 00085 /// Constructor 00086 CredentialsCurator (void); 00087 00088 static CredentialsCurator_ptr _duplicate (CredentialsCurator_ptr obj); 00089 static CredentialsCurator_ptr _nil (void); 00090 static CredentialsCurator_ptr _narrow (CORBA::Object_ptr obj 00091 ACE_ENV_ARG_DECL); 00092 00093 /** 00094 * @name SecurityLevel3::CredentialsCurator Methods 00095 * 00096 * Methods required by the SecurityLevel3::CredentialsCurator 00097 * interface. 00098 */ 00099 //@{ 00100 virtual SecurityLevel3::AcquisitionMethodList * supported_methods ( 00101 ACE_ENV_SINGLE_ARG_DECL) 00102 ACE_THROW_SPEC ((CORBA::SystemException)); 00103 00104 virtual SecurityLevel3::CredentialsAcquirer_ptr acquire_credentials ( 00105 const char * acquisition_method, 00106 const CORBA::Any & acquisition_arguments 00107 ACE_ENV_ARG_DECL) 00108 ACE_THROW_SPEC ((CORBA::SystemException)); 00109 00110 virtual SecurityLevel3::OwnCredentialsList * default_creds_list ( 00111 ACE_ENV_SINGLE_ARG_DECL) 00112 ACE_THROW_SPEC ((CORBA::SystemException)); 00113 00114 virtual SecurityLevel3::CredentialsIdList * default_creds_ids ( 00115 ACE_ENV_SINGLE_ARG_DECL) 00116 ACE_THROW_SPEC ((CORBA::SystemException)); 00117 00118 virtual SecurityLevel3::OwnCredentials_ptr get_own_credentials ( 00119 const char * credentials_id 00120 ACE_ENV_ARG_DECL) 00121 ACE_THROW_SPEC ((CORBA::SystemException)); 00122 00123 virtual void release_own_credentials (const char * credentials_id 00124 ACE_ENV_ARG_DECL) 00125 ACE_THROW_SPEC ((CORBA::SystemException)); 00126 //@} 00127 00128 /// Register CredentialsAcquirer factory. 00129 /** 00130 * @note The CredentialsCurator retains ownership of the 00131 * factory. 00132 */ 00133 void register_acquirer_factory ( 00134 const char * acquisition_method, 00135 TAO::SL3::CredentialsAcquirerFactory * factory 00136 ACE_ENV_ARG_DECL); 00137 00138 /// TAO-specific means of adding credentials to this 00139 /// CredentialsCurator's "own credentials" list. 00140 void _tao_add_own_credentials ( 00141 SecurityLevel3::OwnCredentials_ptr credentials 00142 ACE_ENV_ARG_DECL); 00143 00144 protected: 00145 00146 /// Destructor 00147 /** 00148 * Protected destructor to enforce proper memory management 00149 * through the reference counting mechanism. 00150 */ 00151 ~CredentialsCurator (void); 00152 00153 private: 00154 00155 /// Lock used to synchronize access to underlying tables. 00156 TAO_SYNCH_MUTEX lock_; 00157 00158 /// Table of CredentialsAcquirer factories. 00159 Acquirer_Factory_Table acquirer_factories_; 00160 00161 /// Table of OwnCredentials. 00162 Credentials_Table credentials_table_; 00163 }; 00164 } // End SL3 namespace 00165 } // End TAO namespace 00166 00167 00168 TAO_END_VERSIONED_NAMESPACE_DECL 00169 00170 #if defined(_MSC_VER) 00171 #pragma warning(pop) 00172 #endif /* _MSC_VER */ 00173 00174 #include /**/ "ace/post.h" 00175 00176 #endif /* TAO_SL3_CREDENTIALS_CURATOR_H */