X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=samltest%2Fsaml2%2Fbinding%2FSAML2ArtifactTest.h;h=958e5ed62e45e3bb0ace441d8e2ef42fbecd2438;hb=c0b92549e28e1fca5e7c4a8d09dc06fd09f65292;hp=c785bd34c7e6e1322846e9f8c1f7412f74846a08;hpb=b66d32ed939fcf6db7bc52c8626b6ac06a2e97f9;p=shibboleth%2Fcpp-opensaml.git diff --git a/samltest/saml2/binding/SAML2ArtifactTest.h b/samltest/saml2/binding/SAML2ArtifactTest.h index c785bd3..958e5ed 100644 --- a/samltest/saml2/binding/SAML2ArtifactTest.h +++ b/samltest/saml2/binding/SAML2ArtifactTest.h @@ -28,12 +28,10 @@ class SAML2ArtifactTest : public CxxTest::TestSuite, public SAMLBindingBaseTestCase, public MessageEncoder::ArtifactGenerator, public MessageDecoder::ArtifactResolver { public: void setUp() { - m_fields.clear(); SAMLBindingBaseTestCase::setUp(); } void tearDown() { - m_fields.clear(); SAMLBindingBaseTestCase::tearDown(); } @@ -54,39 +52,39 @@ public: // Encode message. auto_ptr encoder( - SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAMLConstants::SAML20_BINDING_HTTP_ARTIFACT, NULL) + SAMLConfig::getConfig().MessageEncoderManager.newPlugin(samlconstants::SAML20_BINDING_HTTP_ARTIFACT, NULL) ); encoder->setArtifactGenerator(this); - encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state",m_creds); + encoder->encode(*this,toSend.get(),"https://sp.example.org/SAML/Artifact","https://sp.example.org/","state",m_creds); toSend.release(); // Decode message. string relayState; const RoleDescriptor* issuer=NULL; - bool trusted=false; - QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME); + const XMLCh* securityMech=NULL; + QName idprole(samlconstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME); auto_ptr decoder( - SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAMLConstants::SAML20_BINDING_HTTP_ARTIFACT, NULL) + SAMLConfig::getConfig().MessageDecoderManager.newPlugin(samlconstants::SAML20_BINDING_HTTP_ARTIFACT, NULL) ); decoder->setArtifactResolver(this); Locker locker(m_metadata); auto_ptr response( dynamic_cast( - decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust) + decoder->decode(relayState,issuer,securityMech,*this,m_metadata,&idprole,m_trust) ) ); // Test the results. TSM_ASSERT_EQUALS("RelayState was not the expected result.", relayState, "state"); TSM_ASSERT("SAML Response not decoded successfully.", response.get()); - TSM_ASSERT("Message was not verified.", issuer && trusted); + TSM_ASSERT("Message was not verified.", issuer && securityMech && securityMech==samlconstants::SAML20P_NS); auto_ptr_char entityID(dynamic_cast(issuer->getParent())->getEntityID()); TSM_ASSERT("Issuer was not expected.", !strcmp(entityID.get(),"https://idp.example.org/")); TSM_ASSERT_EQUALS("Assertion count was not correct.", response->getAssertions().size(), 1); // Trigger a replay. TSM_ASSERT_THROWS("Did not catch the replay.", - decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust), + decoder->decode(relayState,issuer,securityMech,*this,m_metadata,&idprole,m_trust), BindingException); } catch (XMLToolingException& ex) { @@ -94,18 +92,6 @@ public: throw; } } - - const char* getMethod() const { - return "GET"; - } - - const char* getRequestURL() const { - return "https://sp.example.org/SAML/Artifact"; - } - - const char* getQueryString() const { - return NULL; - } SAMLArtifact* generateSAML1Artifact(const char* relyingParty) const { throw BindingException("Not implemented."); @@ -116,7 +102,7 @@ public: } saml1p::Response* resolve( - bool& authenticated, + const XMLCh*& securityMech, const vector& artifacts, const IDPSSODescriptor& idpDescriptor, const X509TrustEngine* trustEngine=NULL @@ -125,7 +111,7 @@ public: } ArtifactResponse* resolve( - bool& authenticated, + const XMLCh*& securityMech, const SAML2Artifact& artifact, const SSODescriptorType& ssoDescriptor, const X509TrustEngine* trustEngine=NULL @@ -143,7 +129,7 @@ public: sc->setValue(StatusCode::SUCCESS); response->marshall(); SchemaValidators.validate(response.get()); - authenticated = true; + securityMech = NULL; return response.release(); } };