00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file SL3_CredentialsCurator.h 00006 * 00007 * $Id: SL3_CredentialsCurator.h 77001 2007-02-12 07:54:49Z johnnyw $ 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 00092 /** 00093 * @name SecurityLevel3::CredentialsCurator Methods 00094 * 00095 * Methods required by the SecurityLevel3::CredentialsCurator 00096 * interface. 00097 */ 00098 //@{ 00099 virtual SecurityLevel3::AcquisitionMethodList * supported_methods (); 00100 00101 virtual SecurityLevel3::CredentialsAcquirer_ptr acquire_credentials ( 00102 const char * acquisition_method, 00103 const CORBA::Any & acquisition_arguments); 00104 00105 virtual SecurityLevel3::OwnCredentialsList * default_creds_list (); 00106 00107 virtual SecurityLevel3::CredentialsIdList * default_creds_ids (); 00108 00109 virtual SecurityLevel3::OwnCredentials_ptr get_own_credentials ( 00110 const char * credentials_id); 00111 00112 virtual void release_own_credentials (const char * credentials_id); 00113 //@} 00114 00115 /// Register CredentialsAcquirer factory. 00116 /** 00117 * @note The CredentialsCurator retains ownership of the 00118 * factory. 00119 */ 00120 void register_acquirer_factory ( 00121 const char * acquisition_method, 00122 TAO::SL3::CredentialsAcquirerFactory * factory); 00123 00124 /// TAO-specific means of adding credentials to this 00125 /// CredentialsCurator's "own credentials" list. 00126 void _tao_add_own_credentials ( 00127 SecurityLevel3::OwnCredentials_ptr credentials); 00128 00129 protected: 00130 00131 /// Destructor 00132 /** 00133 * Protected destructor to enforce proper memory management 00134 * through the reference counting mechanism. 00135 */ 00136 ~CredentialsCurator (void); 00137 00138 private: 00139 00140 /// Lock used to synchronize access to underlying tables. 00141 TAO_SYNCH_MUTEX lock_; 00142 00143 /// Table of CredentialsAcquirer factories. 00144 Acquirer_Factory_Table acquirer_factories_; 00145 00146 /// Table of OwnCredentials. 00147 Credentials_Table credentials_table_; 00148 }; 00149 } // End SL3 namespace 00150 } // End TAO namespace 00151 00152 00153 TAO_END_VERSIONED_NAMESPACE_DECL 00154 00155 #if defined(_MSC_VER) 00156 #pragma warning(pop) 00157 #endif /* _MSC_VER */ 00158 00159 #include /**/ "ace/post.h" 00160 00161 #endif /* TAO_SL3_CREDENTIALS_CURATOR_H */