Shift policy responsibility to ArtifactResolver, make msg rules more forgiving.
[shibboleth/cpp-opensaml.git] / samltest / saml2 / binding / SAML2ArtifactTest.h
index 5e3a408..7add2f8 100644 (file)
@@ -38,7 +38,7 @@ public:
     void testSAML2Artifact() {\r
         try {\r
             QName idprole(samlconstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);\r
-            SecurityPolicy policy(m_rules, m_metadata, &idprole, m_trust);\r
+            SecurityPolicy policy(m_rules2, m_metadata, &idprole, m_trust);\r
 \r
             // Read message to use from file.\r
             string path = data_path + "saml2/binding/SAML2Response.xml";\r
@@ -73,12 +73,13 @@ public:
             // Test the results.\r
             TSM_ASSERT_EQUALS("RelayState was not the expected result.", relayState, "state");\r
             TSM_ASSERT("SAML Response not decoded successfully.", response.get());\r
-            TSM_ASSERT("Message was not verified.", policy.getIssuer()!=NULL);\r
+            TSM_ASSERT("Message was not verified.", policy.isSecure());\r
             auto_ptr_char entityID(policy.getIssuer()->getName());\r
             TSM_ASSERT("Issuer was not expected.", !strcmp(entityID.get(),"https://idp.example.org/"));\r
             TSM_ASSERT_EQUALS("Assertion count was not correct.", response->getAssertions().size(), 1);\r
 \r
             // Trigger a replay.\r
+            policy.reset();\r
             TSM_ASSERT_THROWS("Did not catch the replay.", decoder->decode(relayState,*this,policy), BindingException);\r
         }\r
         catch (XMLToolingException& ex) {\r
@@ -121,6 +122,7 @@ public:
         sc->setValue(StatusCode::SUCCESS);\r
         response->marshall();\r
         SchemaValidators.validate(response.get());\r
+        policy.evaluate(*(response.get()), this);\r
         return response.release();\r
     }\r
 };\r