X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=samltest%2Fencryption%2FEncryptedAssertionTest.h;h=c73704d205f6b1054f585bde81ced7c9025fe5e0;hb=3582107119b14aeb81632921dd9442ef52cf64db;hp=70eb860f313a2d13b340c7fea1621a900d9f6671;hpb=19a320b1a8d5c733503a4b1aa842865d59b25d24;p=shibboleth%2Fcpp-opensaml.git diff --git a/samltest/encryption/EncryptedAssertionTest.h b/samltest/encryption/EncryptedAssertionTest.h index 70eb860..c73704d 100644 --- a/samltest/encryption/EncryptedAssertionTest.h +++ b/samltest/encryption/EncryptedAssertionTest.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Internet2 + * Copyright 2001-2009 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,12 +17,14 @@ #include "signature/SAMLSignatureTestBase.h" #include +#include #include #include #include #include #include #include +#include using namespace opensaml::saml2md; using namespace opensaml::saml2; @@ -94,7 +96,7 @@ public: // Sign while marshalling. vector sigs(1,sig); CredentialCriteria cc; - cc.setUsage(CredentialCriteria::SIGNING_CREDENTIAL); + cc.setUsage(Credential::SIGNING_CREDENTIAL); Locker locker(m_resolver); const Credential* cred = m_resolver->resolve(&cc); TSM_ASSERT("Retrieved credential was null", cred!=NULL); @@ -111,12 +113,14 @@ public: // Now encrypt this puppy to the SP role in the example metadata. auto_ptr encrypted(EncryptedAssertionBuilder::buildEncryptedAssertion()); Locker mlocker(m_metadata); - const EntityDescriptor* sp = m_metadata->getEntityDescriptor("https://sp.example.org/"); - TSM_ASSERT("No metadata for recipient.", sp!=NULL); - const SPSSODescriptor* sprole = sp->getSPSSODescriptor(samlconstants::SAML20P_NS); - TSM_ASSERT("No SP role for recipient.", sprole!=NULL); - MetadataCredentialCriteria mcc(*sprole); - vector< pair > recipients(1, make_pair(m_metadata, &mcc)); + MetadataProvider::Criteria mc("https://sp.example.org/", &SPSSODescriptor::ELEMENT_QNAME, samlconstants::SAML20P_NS); + pair sp = m_metadata->getEntityDescriptor(mc); + TSM_ASSERT("No metadata for recipient.", sp.first!=NULL); + TSM_ASSERT("No SP role for recipient.", sp.second!=NULL); + MetadataCredentialCriteria mcc(*sp.second); + vector< pair > recipients( + 1, pair(m_metadata, &mcc) + ); encrypted->encrypt(*assertion.get(), recipients); // Roundtrip it. @@ -129,7 +133,7 @@ public: // Unpack, then decypt with our key. auto_ptr encrypted2(dynamic_cast(b->buildFromDocument(doc))); - auto_ptr assertion2(dynamic_cast(encrypted2->decrypt(*m_resolver, sp->getEntityID()))); + auto_ptr assertion2(dynamic_cast(encrypted2->decrypt(*m_resolver, sp.first->getEntityID()))); assertEquals("Unmarshalled assertion does not match", expectedChildElementsDOM, assertion2.get(), false); // And check the signature.