Convert role lookups to find_if algorithm.
[shibboleth/sp.git] / shibsp / handler / impl / SAML2LogoutInitiator.cpp
index 17e190d..eddd725 100644 (file)
@@ -71,6 +71,12 @@ namespace shibsp {
         void receive(DDF& in, ostream& out);
         pair<bool,long> run(SPRequest& request, bool isHandler=true) const;
 
+#ifndef SHIBSP_LITE
+        const char* getType() const {
+            return "LogoutInitiator";
+        }
+#endif
+
     private:
         pair<bool,long> doRequest(const Application& application, const char* requestURL, Session* session, HTTPResponse& httpResponse) const;
 
@@ -289,7 +295,7 @@ pair<bool,long> SAML2LogoutInitiator::doRequest(
                 namedparams(1, "entityID", session->getEntityID())
                 );
         }
-        const IDPSSODescriptor* role = entity->getIDPSSODescriptor(samlconstants::SAML20P_NS);
+        const IDPSSODescriptor* role = find_if(entity->getIDPSSODescriptors(), isValidForProtocol(samlconstants::SAML20P_NS));
         if (!role) {
             throw MetadataException(
                 "Unable to locate SAML 2.0 IdP role for identity provider ($entityID).",
@@ -325,7 +331,7 @@ pair<bool,long> SAML2LogoutInitiator::doRequest(
                     auto_ptr_char dest((*epit)->getLocation());
 
                     SAML2SOAPClient client(soaper, false);
-                    client.sendSAML(msg, mcc, dest.get());
+                    client.sendSAML(msg, application.getId(), mcc, dest.get());
                     StatusResponseType* srt = client.receiveSAML();
                     if (!(logoutResponse = dynamic_cast<LogoutResponse*>(srt))) {
                         delete srt;
@@ -430,7 +436,7 @@ LogoutRequest* SAML2LogoutInitiator::buildRequest(
                 Locker credLocker(credResolver);
                 // Fill in criteria to use.
                 MetadataCredentialCriteria mcc(role);
-                mcc.setUsage(CredentialCriteria::SIGNING_CREDENTIAL);
+                mcc.setUsage(Credential::SIGNING_CREDENTIAL);
                 pair<bool,const char*> keyName = relyingParty->getString("keyName");
                 if (keyName.first)
                     mcc.getKeyNames().insert(keyName.second);