Added marker interface for assertion types.
[shibboleth/cpp-opensaml.git] / samltest / saml1 / binding / SAML1ArtifactTest.h
index 30f4dc9..9c39c47 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- *  Copyright 2001-2005 Internet2\r
+ *  Copyright 2001-2007 Internet2\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -51,15 +51,15 @@ public:
     void testSAML1Artifact() {\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_rules1, m_metadata, &idprole, m_trust, false);\r
 \r
             // Read message to use from file.\r
             string path = data_path + "saml1/binding/SAML1Assertion.xml";\r
             ifstream in(path.c_str());\r
             DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
             XercesJanitor<DOMDocument> janitor(doc);\r
-            auto_ptr<Assertion> toSend(\r
-                dynamic_cast<Assertion*>(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(),true))\r
+            auto_ptr<saml1::Assertion> toSend(\r
+                dynamic_cast<saml1::Assertion*>(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(),true))\r
                 );\r
             janitor.release();\r
 \r
@@ -83,12 +83,13 @@ public:
             // Test the results.\r
             TSM_ASSERT_EQUALS("TARGET 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
@@ -132,7 +133,7 @@ public:
         TSM_ASSERT_EQUALS("Too many artifacts.", artifacts.size(), 1);\r
         XMLObject* xmlObject =\r
             SAMLConfig::getConfig().getArtifactMap()->retrieveContent(artifacts.front(), "https://sp.example.org/");\r
-        Assertion* assertion = dynamic_cast<Assertion*>(xmlObject);\r
+        saml1::Assertion* assertion = dynamic_cast<saml1::Assertion*>(xmlObject);\r
         TSM_ASSERT("Not an assertion.", assertion!=NULL);\r
         auto_ptr<Response> response(ResponseBuilder::buildResponse());\r
         response->getAssertions().push_back(assertion);\r
@@ -145,6 +146,7 @@ public:
         vector<Signature*> sigs(1,response->getSignature());\r
         response->marshall((DOMDocument*)NULL,&sigs);\r
         SchemaValidators.validate(response.get());\r
+        policy.evaluate(*(response.get()), this);\r
         return response.release();\r
     }\r
 \r