00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TAO_SL2_SECURITY_MANAGER_H
00015 #define TAO_SL2_SECURITY_MANAGER_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
00023
00024 #include "orbsvcs/SecurityC.h"
00025 #include "orbsvcs/SecurityLevel2C.h"
00026
00027 #include "tao/LocalObject.h"
00028 #include "tao/PortableServer/PS_ForwardC.h"
00029
00030 #include "ace/Hash_Map_Manager_T.h"
00031 #include "ace/Null_Mutex.h"
00032
00033 #if defined(_MSC_VER)
00034 #pragma warning(push)
00035 #pragma warning(disable:4250)
00036 #endif
00037
00038
00039 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00040
00041 namespace TAO
00042 {
00043
00044 namespace Security
00045 {
00046
00047
00048
00049
00050
00051
00052
00053 class AccessDecision
00054 : public virtual TAO::SL2::AccessDecision,
00055 public virtual TAO_Local_RefCounted_Object
00056 {
00057 public:
00058
00059 AccessDecision ();
00060 ~AccessDecision (void);
00061
00062 virtual ::CORBA::Boolean access_allowed (
00063 const ::SecurityLevel2::CredentialsList & cred_list,
00064 ::CORBA::Object_ptr target,
00065 const char * operation_name,
00066 const char * target_interface_name
00067 );
00068
00069 virtual ::CORBA::Boolean access_allowed_ex (
00070 const char * orb_id,
00071 const ::CORBA::OctetSeq & adapter_id,
00072 const ::CORBA::OctetSeq & object_id,
00073 const ::SecurityLevel2::CredentialsList & cred_list,
00074 const char * operation_name);
00075
00076 virtual ::CORBA::Boolean default_decision (void);
00077 virtual void default_decision (::CORBA::Boolean d);
00078
00079 virtual void add_object (const char * orbid,
00080 const ::CORBA::OctetSeq & adapter_id,
00081 const ::CORBA::OctetSeq & object_id,
00082 ::CORBA::Boolean allow_insecure_access);
00083
00084 virtual void remove_object (const char * orbid,
00085 const ::CORBA::OctetSeq & adapter_id,
00086 const ::CORBA::OctetSeq & object_id);
00087
00088 private:
00089
00090
00091
00092
00093 ::CORBA::Boolean default_allowance_decision_;
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108 struct ReferenceKeyType
00109 {
00110 PortableServer::ObjectId_var oid_;
00111 CORBA::OctetSeq_var adapter_id_;
00112 CORBA::String_var orbid_;
00113
00114
00115
00116 bool operator== (const ReferenceKeyType& other) const;
00117 CORBA::ULong hash() const;
00118
00119
00120 operator const char * () const;
00121 };
00122 typedef ReferenceKeyType OBJECT_KEY;
00123
00124
00125
00126
00127
00128
00129
00130 typedef ACE_Hash_Map_Manager_Ex<OBJECT_KEY,
00131 CORBA::Boolean,
00132 ACE_Hash<OBJECT_KEY>,
00133 ACE_Equal_To<OBJECT_KEY>,
00134 ACE_Null_Mutex>
00135 ACCESS_MAP_TYPE;
00136
00137 ACCESS_MAP_TYPE access_map_;
00138
00139
00140
00141
00142 TAO_SYNCH_MUTEX map_lock_;
00143
00144 private:
00145
00146
00147
00148
00149
00150
00151 OBJECT_KEY map_key_from_objref (CORBA::Object_ptr obj);
00152
00153
00154
00155
00156 ::CORBA::Boolean access_allowed_i (OBJECT_KEY& key,
00157 const char *operation_name);
00158
00159 };
00160
00161
00162
00163
00164
00165
00166
00167 class SecurityManager
00168 : public virtual SecurityLevel2::SecurityManager,
00169 public virtual TAO_Local_RefCounted_Object
00170 {
00171 public:
00172
00173
00174 SecurityManager ();
00175
00176
00177
00178
00179
00180
00181
00182
00183 virtual ::Security::MechandOptionsList* supported_mechanisms ();
00184 virtual SecurityLevel2::CredentialsList* own_credentials ();
00185 virtual SecurityLevel2::RequiredRights_ptr required_rights_object ();
00186 virtual SecurityLevel2::PrincipalAuthenticator_ptr principal_authenticator ();
00187 virtual SecurityLevel2::AccessDecision_ptr access_decision ();
00188 virtual SecurityLevel2::AuditDecision_ptr audit_decision ();
00189 virtual SecurityLevel2::TargetCredentials_ptr get_target_credentials (CORBA::Object_ptr o);
00190 virtual void remove_own_credentials (SecurityLevel2::Credentials_ptr creds);
00191 virtual CORBA::Policy_ptr get_security_policy (CORBA::PolicyType policy_type);
00192
00193
00194 protected:
00195
00196
00197
00198
00199
00200
00201 virtual ~SecurityManager (void);
00202
00203 private:
00204
00205
00206
00207
00208 SecurityLevel2::PrincipalAuthenticator_var principal_authenticator_;
00209
00210
00211 SecurityLevel2::AccessDecision_var access_decision_;
00212 };
00213
00214 }
00215 }
00216
00217 TAO_END_VERSIONED_NAMESPACE_DECL
00218
00219
00220 #if defined(_MSC_VER)
00221 #pragma warning(pop)
00222 #endif
00223
00224 #include "ace/post.h"
00225
00226 #endif