00001 // -*- C++ -*- 00002 00003 // =================================================================== 00004 /** 00005 * @file Security_Current.h 00006 * 00007 * $Id: Security_Current.h 77001 2007-02-12 07:54:49Z johnnyw $ 00008 * 00009 * @author Ossama Othman <ossama@uci.edu> 00010 */ 00011 // =================================================================== 00012 00013 #ifndef TAO_SECURITY_CURRENT_H 00014 #define TAO_SECURITY_CURRENT_H 00015 00016 #include /**/ "ace/pre.h" 00017 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/SecurityLevel2C.h" 00025 #include "tao/ORB_Core.h" 00026 #include "tao/LocalObject.h" 00027 00028 #include "orbsvcs/Security/Security_Current_Impl.h" 00029 00030 // This is to remove "inherits via dominance" warnings from MSVC. 00031 // MSVC is being a little too paranoid. 00032 #if defined(_MSC_VER) 00033 #pragma warning(push) 00034 #pragma warning(disable:4250) 00035 #endif /* _MSC_VER */ 00036 00037 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00038 00039 /** 00040 * @class TAO_Security_Current 00041 * 00042 * @brief Implementation of the SecurityLevel2::Current interface. 00043 * 00044 * This object can be used to obtain session related security 00045 * information about the current execution context. 00046 */ 00047 class TAO_Security_Export TAO_Security_Current 00048 : public SecurityLevel2::Current, 00049 public TAO_Local_RefCounted_Object 00050 { 00051 public: 00052 00053 /// Constructor. 00054 TAO_Security_Current (size_t tss_slot, const char *orb_id); 00055 00056 /** 00057 * @name SecurityLevel1::Current Methods 00058 * 00059 * These methods are founds in the SecurityLevel1::Current 00060 * interface. 00061 */ 00062 //@{ 00063 /// Return the security attributes corresponding to the types in the 00064 /// given attribute type list associated with the current request. 00065 virtual Security::AttributeList * get_attributes ( 00066 const Security::AttributeTypeList & attributes); 00067 //@} 00068 00069 /** 00070 * @name SecurityLevel2::Current Methods 00071 * 00072 * These methods are founds in the SecurityLevel2::Current 00073 * interface. 00074 */ 00075 //@{ 00076 /// Return the Credentials received from the client associate with 00077 /// the current request. 00078 virtual SecurityLevel2::ReceivedCredentials_ptr received_credentials (); 00079 //@} 00080 00081 /// Return the TSS slot ID assigned to the "SecurityCurrent" object. 00082 /** 00083 * The concrete TSS SecurityCurrent implementations will each use 00084 * this slot ID. 00085 */ 00086 size_t tss_slot (void) const; 00087 00088 protected: 00089 00090 /// Destructor 00091 /// Protected to force allocation on the heap. 00092 ~TAO_Security_Current (void); 00093 00094 /// Fully initialize this object. This method is used predominantly 00095 /// to set the ORB core pointer. 00096 int init (void); 00097 00098 /// Set the TSS Security::Current implementation. 00099 /** 00100 * The pointer is actually one to a concrete implementation provided 00101 * by the underlying security mechanism. For example, SSLIOP 00102 * implements the SecurityLevel2::Current interface. Similarly, 00103 * SECIOP would do the same. 00104 * 00105 * There is no function that places the implementation pointer in 00106 * TSS. The underlying security mechanism does that. 00107 */ 00108 TAO::Security::Current_Impl *implementation (void); 00109 00110 private: 00111 00112 /// Prevent copying through the copy constructor and the assignment 00113 /// operator. 00114 //@{ 00115 TAO_Security_Current (const TAO_Security_Current &); 00116 void operator= (const TAO_Security_Current &); 00117 //@} 00118 00119 private: 00120 00121 /// TSS slot assigned to this object. 00122 size_t const tss_slot_; 00123 00124 /// The ORBid of the ORB with which this object is registered. 00125 CORBA::String_var orb_id_; 00126 00127 /// Pointer to the ORB Core corresponding to the ORB with which this 00128 /// object is registered. 00129 TAO_ORB_Core * orb_core_; 00130 00131 }; 00132 00133 TAO_END_VERSIONED_NAMESPACE_DECL 00134 00135 #if defined (__ACE_INLINE__) 00136 # include "orbsvcs/Security/Security_Current.inl" 00137 #endif /* __ACE_INLINE__ */ 00138 00139 #if defined(_MSC_VER) 00140 #pragma warning(pop) 00141 #endif /* _MSC_VER */ 00142 00143 #include /**/ "ace/post.h" 00144 00145 #endif /* TAO_SECURITY_CURRENT_H */