Convert role lookups to find_if algorithm.
[shibboleth/cpp-sp.git] / shibsp / handler / impl / SAML2SessionInitiator.cpp
index baa27cf..1e1e0e2 100644 (file)
@@ -409,7 +409,7 @@ pair<bool,long> SAML2SessionInitiator::doRequest(
         throw MetadataException("Unable to locate metadata for identity provider ($entityID)",
             namedparams(1, "entityID", entityID));
     }
-    const IDPSSODescriptor* role=entity->getIDPSSODescriptor(samlconstants::SAML20P_NS);
+    const IDPSSODescriptor* role=find_if(entity->getIDPSSODescriptors(), isValidForProtocol(samlconstants::SAML20P_NS));
     if (!role) {
         m_log.error("unable to locate SAML 2.0 identity provider role for provider (%s)", entityID);
         return make_pair(false,0);
@@ -487,7 +487,7 @@ pair<bool,long> SAML2SessionInitiator::doRequest(
     auto_ptr_char dest(ep->getLocation());
 
     long ret = sendMessage(
-        *encoder, req.get(), relayState.c_str(), dest.get(), role, app, httpResponse, "signRequests", role->WantAuthnRequestsSigned()
+        *encoder, req.get(), relayState.c_str(), dest.get(), role, app, httpResponse, role->WantAuthnRequestsSigned()
         );
     req.release();  // freed by encoder
     return make_pair(true,ret);