Merged trust engines back into a unified version, made metadata roles a "KeyInfoSource".
[shibboleth/opensaml2.git] / saml / binding / impl / SimpleSigningRule.cpp
index 481223d..3a09638 100644 (file)
 
 #include "internal.h"
 #include "exceptions.h"
-#include "RootObject.h"
 #include "binding/HTTPRequest.h"
 #include "binding/SimpleSigningRule.h"
 #include "saml2/core/Protocols.h"
 #include "saml2/metadata/Metadata.h"
 #include "saml2/metadata/MetadataProvider.h"
-#include "security/TrustEngine.h"
 
 #include <log4cpp/Category.hh>
 #include <xmltooling/util/NDC.h>
@@ -69,12 +67,12 @@ namespace opensaml {
 };
 
 
-pair<saml2::Issuer*,const saml2md::RoleDescriptor*> SimpleSigningRule::evaluate(
+pair<saml2::Issuer*,const RoleDescriptor*> SimpleSigningRule::evaluate(
     const GenericRequest& request,
     const XMLObject& message,
     const MetadataProvider* metadataProvider,
     const QName* role,
-    const opensaml::TrustEngine* trustEngine
+    const TrustEngine* trustEngine
     ) const
 {
     Category& log=Category::getInstance(SAML_LOGCAT".SecurityPolicyRule.SimpleSigning");
@@ -118,7 +116,7 @@ pair<saml2::Issuer*,const saml2md::RoleDescriptor*> SimpleSigningRule::evaluate(
             return ret;
         }
 
-        log.debug("matched assertion issuer against metadata, searching for applicable role...");
+        log.debug("matched message issuer against metadata, searching for applicable role...");
         const RoleDescriptor* roledesc=entity->getRoleDescriptor(*role, issuerInfo.second);
         if (!roledesc) {
             log.warn("unable to find compatible role (%s) in metadata", role->toString().c_str());
@@ -202,13 +200,12 @@ pair<saml2::Issuer*,const XMLCh*> SimpleSigningRule::getIssuerAndProtocol(const
     // Shortcuts some of the casting.
     const XMLCh* ns = message.getElementQName().getNamespaceURI();
     if (ns) {
-        if (XMLString::equals(ns, samlconstants::SAML20P_NS) || XMLString::equals(ns, samlconstants::SAML20_NS)) {
+        if (XMLString::equals(ns, samlconstants::SAML20P_NS)) {
             // 2.0 namespace should be castable to a specialized 2.0 root.
             const saml2::RootObject& root = dynamic_cast<const saml2::RootObject&>(message);
             saml2::Issuer* issuer = root.getIssuer();
-            if (issuer && issuer->getName()) {
+            if (issuer && issuer->getName())
                 return make_pair(issuer->cloneIssuer(), samlconstants::SAML20P_NS);
-            }
             
             // No issuer in the message, so we have to try the Response approach. 
             const vector<saml2::Assertion*>& assertions = dynamic_cast<const saml2p::Response&>(message).getAssertions();