Switch encoders to metadata-based recipient parameter.
[shibboleth/cpp-opensaml.git] / samltest / saml1 / binding / SAML1POSTTest.h
index c6284df..81c1d7e 100644 (file)
@@ -46,6 +46,12 @@ public:
                 );
             janitor.release();
 
+            CredentialCriteria cc;
+            cc.setUsage(CredentialCriteria::SIGNING_CREDENTIAL);
+            Locker clocker(m_creds);
+            const Credential* cred = m_creds->resolve(&cc);
+            TSM_ASSERT("Retrieved credential was null", cred!=NULL);
+
             // Freshen timestamp and ID.
             toSend->setIssueInstant(time(NULL));
             toSend->setResponseID(NULL);
@@ -64,7 +70,11 @@ public:
                     samlconstants::SAML1_PROFILE_BROWSER_POST, encoder_config->getDocumentElement()
                     )
                 );
-            encoder->encode(*this,toSend.get(),"https://sp.example.org/SAML/SSO","https://sp.example.org/","state",m_creds);
+
+            Locker locker(m_metadata);
+            encoder->encode(
+                *this,toSend.get(),"https://sp.example.org/SAML/SSO",m_metadata->getEntityDescriptor("https://sp.example.org/"),"state",cred
+                );
             toSend.release();
             
             // Decode message.
@@ -72,7 +82,6 @@ public:
             auto_ptr<MessageDecoder> decoder(
                 SAMLConfig::getConfig().MessageDecoderManager.newPlugin(samlconstants::SAML1_PROFILE_BROWSER_POST, NULL)
                 );
-            Locker locker(m_metadata);
             auto_ptr<Response> response(dynamic_cast<Response*>(decoder->decode(relayState,*this,policy)));
             
             // Test the results.