projects
/
shibboleth
/
cpp-opensaml.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow message-only policy rules, basic SAML SOAP client.
[shibboleth/cpp-opensaml.git]
/
saml
/
binding
/
impl
/
SecurityPolicy.cpp
diff --git
a/saml/binding/impl/SecurityPolicy.cpp
b/saml/binding/impl/SecurityPolicy.cpp
index
0b30af3
..
350057e
100644
(file)
--- a/
saml/binding/impl/SecurityPolicy.cpp
+++ b/
saml/binding/impl/SecurityPolicy.cpp
@@
-23,7
+23,10
@@
#include "internal.h"
#include "exceptions.h"
#include "binding/SecurityPolicy.h"
#include "internal.h"
#include "exceptions.h"
#include "binding/SecurityPolicy.h"
+#include "saml1/core/Assertions.h"
+#include "saml1/core/Protocols.h"
#include "saml2/core/Assertions.h"
#include "saml2/core/Assertions.h"
+#include "saml2/core/Protocols.h"
using namespace opensaml::saml2md;
using namespace opensaml::saml2;
using namespace opensaml::saml2md;
using namespace opensaml::saml2;
@@
-32,33
+35,40
@@
using namespace xmltooling;
using namespace std;
namespace opensaml {
using namespace std;
namespace opensaml {
+ SAML_DLLLOCAL PluginManager<SecurityPolicyRule,const DOMElement*>::Factory ClientCertAuthRuleFactory;
SAML_DLLLOCAL PluginManager<SecurityPolicyRule,const DOMElement*>::Factory MessageFlowRuleFactory;
SAML_DLLLOCAL PluginManager<SecurityPolicyRule,const DOMElement*>::Factory MessageFlowRuleFactory;
- SAML_DLLLOCAL PluginManager<SecurityPolicyRule,const DOMElement*>::Factory MessageSigningRuleFactory;
+ SAML_DLLLOCAL PluginManager<SecurityPolicyRule,const DOMElement*>::Factory SimpleSigningRuleFactory;
+ SAML_DLLLOCAL PluginManager<SecurityPolicyRule,const DOMElement*>::Factory XMLSigningRuleFactory;
};
void SAML_API opensaml::registerSecurityPolicyRules()
{
SAMLConfig& conf=SAMLConfig::getConfig();
};
void SAML_API opensaml::registerSecurityPolicyRules()
{
SAMLConfig& conf=SAMLConfig::getConfig();
+ conf.SecurityPolicyRuleManager.registerFactory(CLIENTCERTAUTH_POLICY_RULE, ClientCertAuthRuleFactory);
conf.SecurityPolicyRuleManager.registerFactory(MESSAGEFLOW_POLICY_RULE, MessageFlowRuleFactory);
conf.SecurityPolicyRuleManager.registerFactory(MESSAGEFLOW_POLICY_RULE, MessageFlowRuleFactory);
- conf.SecurityPolicyRuleManager.registerFactory(MESSAGESIGNING_POLICY_RULE, MessageSigningRuleFactory);
+ conf.SecurityPolicyRuleManager.registerFactory(SIMPLESIGNING_POLICY_RULE, SimpleSigningRuleFactory);
+ conf.SecurityPolicyRuleManager.registerFactory(XMLSIGNING_POLICY_RULE, XMLSigningRuleFactory);
}
}
+SecurityPolicy::IssuerMatchingPolicy SecurityPolicy::m_defaultMatching;
+
SecurityPolicy::~SecurityPolicy()
{
SecurityPolicy::~SecurityPolicy()
{
+ delete m_matchingPolicy;
delete m_issuer;
}
delete m_issuer;
}
-void SecurityPolicy::evaluate(const
GenericRequest& request, const XMLObject& message
)
+void SecurityPolicy::evaluate(const
XMLObject& message, const GenericRequest* request
)
{
for (vector<const SecurityPolicyRule*>::const_iterator i=m_rules.begin(); i!=m_rules.end(); ++i) {
// Run the rule...
{
for (vector<const SecurityPolicyRule*>::const_iterator i=m_rules.begin(); i!=m_rules.end(); ++i) {
// Run the rule...
- pair<Issuer*,const RoleDescriptor*> ident = (*i)->evaluate(
request,message
,m_metadata,&m_role,m_trust);
+ pair<Issuer*,const RoleDescriptor*> ident = (*i)->evaluate(
message,request
,m_metadata,&m_role,m_trust);
// Make sure returned issuer doesn't conflict.
if (ident.first) {
// Make sure returned issuer doesn't conflict.
if (ident.first) {
- if (!issuerMatches(ident.first, m_issuer)) {
+ if (!
getIssuerMatchingPolicy().
issuerMatches(ident.first, m_issuer)) {
delete ident.first;
throw BindingException("Policy rules returned differing Issuers.");
}
delete ident.first;
throw BindingException("Policy rules returned differing Issuers.");
}
@@
-76,7
+86,7
@@
void SecurityPolicy::evaluate(const GenericRequest& request, const XMLObject& me
void SecurityPolicy::setIssuer(saml2::Issuer* issuer)
{
void SecurityPolicy::setIssuer(saml2::Issuer* issuer)
{
- if (!issuerMatches(issuer, m_issuer)) {
+ if (!
getIssuerMatchingPolicy().
issuerMatches(issuer, m_issuer)) {
delete issuer;
throw BindingException("Externally provided Issuer conflicts with policy results.");
}
delete issuer;
throw BindingException("Externally provided Issuer conflicts with policy results.");
}
@@
-85,14
+95,14
@@
void SecurityPolicy::setIssuer(saml2::Issuer* issuer)
m_issuer=issuer;
}
m_issuer=issuer;
}
-void SecurityPolicy::setIssuerMetadata(const
saml2md::
RoleDescriptor* issuerRole)
+void SecurityPolicy::setIssuerMetadata(const RoleDescriptor* issuerRole)
{
if (issuerRole && m_issuerRole && issuerRole!=m_issuerRole)
throw BindingException("Externally provided RoleDescriptor conflicts with policy results.");
m_issuerRole=issuerRole;
}
{
if (issuerRole && m_issuerRole && issuerRole!=m_issuerRole)
throw BindingException("Externally provided RoleDescriptor conflicts with policy results.");
m_issuerRole=issuerRole;
}
-bool SecurityPolicy::issuerMatches(const Issuer* issuer1, const Issuer* issuer2) const
+bool SecurityPolicy::
IssuerMatchingPolicy::
issuerMatches(const Issuer* issuer1, const Issuer* issuer2) const
{
// NULL matches anything for the purposes of this interface.
if (!issuer1 || !issuer2)
{
// NULL matches anything for the purposes of this interface.
if (!issuer1 || !issuer2)