Move artifact generation to a per-instance parameter.
[shibboleth/cpp-opensaml.git] / samltest / saml1 / binding / SAML1POSTTest.h
index aa5cecc..7a89c92 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",NULL,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.
@@ -85,7 +94,7 @@ public:
 
             // Trigger a replay.
             policy.reset();
-            TSM_ASSERT_THROWS("Did not catch the replay.", decoder->decode(relayState,*this,policy), BindingException);
+            TSM_ASSERT_THROWS("Did not catch the replay.", decoder->decode(relayState,*this,policy), SecurityPolicyException);
         }
         catch (XMLToolingException& ex) {
             TS_TRACE(ex.what());