X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=samltest%2Fsaml2%2Fbinding%2FSAML2POSTTest.h;h=f03fbcec663915480c7f25d97d82c682bd2c6913;hb=5cd3da8d9bd792f4a24372ab8e6d24b8409df41a;hp=aed926cb4433c8d34e7aa89859a976ef2b0cddbf;hpb=5d4b679f292a46494e822e9634f0ffa06f8f421c;p=shibboleth%2Fcpp-opensaml.git diff --git a/samltest/saml2/binding/SAML2POSTTest.h b/samltest/saml2/binding/SAML2POSTTest.h index aed926c..f03fbce 100644 --- a/samltest/saml2/binding/SAML2POSTTest.h +++ b/samltest/saml2/binding/SAML2POSTTest.h @@ -34,7 +34,8 @@ public: void testSAML2POST() { try { QName idprole(samlconstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME); - SecurityPolicy policy(m_rules2, m_metadata, &idprole, m_trust, false); + SecurityPolicy policy(m_metadata, &idprole, m_trust, false); + policy.getRules().assign(m_rules.begin(), m_rules.end()); // Read message to use from file. string path = data_path + "saml2/binding/SAML2Response.xml"; @@ -47,7 +48,7 @@ public: janitor.release(); CredentialCriteria cc; - cc.setUsage(CredentialCriteria::SIGNING_CREDENTIAL); + cc.setUsage(Credential::SIGNING_CREDENTIAL); Locker clocker(m_creds); const Credential* cred = m_creds->resolve(&cc); TSM_ASSERT("Retrieved credential was null", cred!=NULL); @@ -67,26 +68,34 @@ public: encoder_config->getDocumentElement()->setAttributeNS(NULL,lit2.get(),lit3.get()); auto_ptr encoder( SAMLConfig::getConfig().MessageEncoderManager.newPlugin( - samlconstants::SAML20_BINDING_HTTP_POST, encoder_config->getDocumentElement() + samlconstants::SAML20_BINDING_HTTP_POST, pair(encoder_config->getDocumentElement(), NULL) ) ); Locker locker(m_metadata); encoder->encode( - *this,toSend.get(),"https://sp.example.org/SAML/SSO",m_metadata->getEntityDescriptor("https://sp.example.org/"),"state",cred + *this, + toSend.get(), + "https://sp.example.org/SAML/SSO", + m_metadata->getEntityDescriptor(MetadataProvider::Criteria("https://sp.example.org/")).first, + "state", + NULL, + cred ); toSend.release(); // Decode message. string relayState; auto_ptr decoder( - SAMLConfig::getConfig().MessageDecoderManager.newPlugin(samlconstants::SAML20_BINDING_HTTP_POST, NULL) + SAMLConfig::getConfig().MessageDecoderManager.newPlugin( + samlconstants::SAML20_BINDING_HTTP_POST, pair(NULL,NULL) + ) ); auto_ptr response(dynamic_cast(decoder->decode(relayState,*this,policy))); // 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.", policy.isSecure()); + TSM_ASSERT("Message was not verified.", policy.isAuthenticated()); auto_ptr_char entityID(policy.getIssuer()->getName()); 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); @@ -104,7 +113,8 @@ public: void testSAML2POSTSimpleSign() { try { QName idprole(samlconstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME); - SecurityPolicy policy(m_rules2, m_metadata, &idprole, m_trust, false); + SecurityPolicy policy(m_metadata, &idprole, m_trust, false); + policy.getRules().assign(m_rules.begin(), m_rules.end()); // Read message to use from file. string path = data_path + "saml2/binding/SAML2Response.xml"; @@ -117,7 +127,7 @@ public: janitor.release(); CredentialCriteria cc; - cc.setUsage(CredentialCriteria::SIGNING_CREDENTIAL); + cc.setUsage(Credential::SIGNING_CREDENTIAL); Locker clocker(m_creds); const Credential* cred = m_creds->resolve(&cc); TSM_ASSERT("Retrieved credential was null", cred!=NULL); @@ -137,26 +147,34 @@ public: encoder_config->getDocumentElement()->setAttributeNS(NULL,lit2.get(),lit3.get()); auto_ptr encoder( SAMLConfig::getConfig().MessageEncoderManager.newPlugin( - samlconstants::SAML20_BINDING_HTTP_POST_SIMPLESIGN, encoder_config->getDocumentElement() + samlconstants::SAML20_BINDING_HTTP_POST_SIMPLESIGN, pair(encoder_config->getDocumentElement(),NULL) ) ); Locker locker(m_metadata); encoder->encode( - *this,toSend.get(),"https://sp.example.org/SAML/SSO",m_metadata->getEntityDescriptor("https://sp.example.org/"),"state",cred + *this, + toSend.get(), + "https://sp.example.org/SAML/SSO", + m_metadata->getEntityDescriptor(MetadataProvider::Criteria("https://sp.example.org/")).first, + "state", + NULL, + cred ); toSend.release(); // Decode message. string relayState; auto_ptr decoder( - SAMLConfig::getConfig().MessageDecoderManager.newPlugin(samlconstants::SAML20_BINDING_HTTP_POST_SIMPLESIGN, NULL) + SAMLConfig::getConfig().MessageDecoderManager.newPlugin( + samlconstants::SAML20_BINDING_HTTP_POST_SIMPLESIGN, pair(NULL,NULL) + ) ); auto_ptr response(dynamic_cast(decoder->decode(relayState,*this,policy))); // 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.", policy.isSecure()); + TSM_ASSERT("Message was not verified.", policy.isAuthenticated()); auto_ptr_char entityID(policy.getIssuer()->getName()); 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);