00001
00002
00003 #include "orbsvcs/Security/SL3_PolicyFactory.h"
00004 #include "orbsvcs/Security/SL3_ContextEstablishmentPolicy.h"
00005 #include "orbsvcs/Security/SL3_ObjectCredentialsPolicy.h"
00006
00007
00008 ACE_RCSID (Security,
00009 SL3_PolicyFactory,
00010 "$Id: SL3_PolicyFactory.cpp 77406 2007-02-26 23:37:11Z ossama $")
00011
00012
00013 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00014
00015 CORBA::Policy_ptr
00016 TAO::SL3::PolicyFactory::create_policy (CORBA::PolicyType type,
00017 const CORBA::Any & value)
00018 {
00019 CORBA::Policy_ptr policy = CORBA::Policy_ptr ();
00020
00021 if (type == SecurityLevel3::ContextEstablishmentPolicyType)
00022 {
00023 SecurityLevel3::ContextEstablishmentPolicyArgument * arg = 0;
00024 if (!(value >>= arg))
00025 throw CORBA::INTERNAL ();
00026
00027 ACE_NEW_THROW_EX (policy,
00028 TAO::SL3::ContextEstablishmentPolicy (
00029 arg->creds_directive,
00030 arg->creds_list,
00031 arg->use_client_auth,
00032 arg->use_target_auth,
00033 arg->use_confidentiality,
00034 arg->use_integrity),
00035 CORBA::NO_MEMORY ());
00036 }
00037 else if (type == SecurityLevel3::ObjectCredentialsPolicyType)
00038 {
00039 SecurityLevel3::ObjectCredentialsPolicyArgument * creds = 0;
00040 if (!(value >>= creds))
00041 throw CORBA::INTERNAL ();
00042
00043 ACE_NEW_THROW_EX (policy,
00044 TAO::SL3::ObjectCredentialsPolicy (*creds),
00045 CORBA::NO_MEMORY ());
00046 }
00047 else
00048 {
00049 throw CORBA::PolicyError (CORBA::BAD_POLICY_TYPE);
00050 }
00051
00052 return policy;
00053 }
00054
00055 TAO_END_VERSIONED_NAMESPACE_DECL