X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=samltest%2Fsignature%2FSAML2AssertionTest.h;h=38fec27db63b10e9f962063d09f61f440e8e132a;hb=9424cbad0360d512935936e6410fca5e32eb29bc;hp=22a8a5724579588f63cd5cf54be2408943fe3102;hpb=1ffcb743f90aeb3da11054316f3d005ff7edbf7b;p=shibboleth%2Fcpp-opensaml.git diff --git a/samltest/signature/SAML2AssertionTest.h b/samltest/signature/SAML2AssertionTest.h index 22a8a57..38fec27 100644 --- a/samltest/signature/SAML2AssertionTest.h +++ b/samltest/signature/SAML2AssertionTest.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2005 Internet2 + * Copyright 2001-2007 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,21 +66,18 @@ public: // Append a Signature. Signature* sig=SignatureBuilder::buildSignature(); assertion->setSignature(sig); - Locker locker(m_resolver); - sig->setSigningKey(m_resolver->getKey()); - - // Build KeyInfo. - KeyInfo* keyInfo=KeyInfoBuilder::buildKeyInfo(); - X509Data* x509Data=X509DataBuilder::buildX509Data(); - keyInfo->getX509Datas().push_back(x509Data); - for_each(m_resolver->getCertificates().begin(),m_resolver->getCertificates().end(),bind1st(_addcert(),x509Data)); - sig->setKeyInfo(keyInfo); // Sign while marshalling. vector sigs(1,sig); + CredentialCriteria cc; + cc.setUsage(Credential::SIGNING_CREDENTIAL); + Locker locker(m_resolver); + const Credential* cred = m_resolver->resolve(&cc); + TSM_ASSERT("Retrieved credential was null", cred!=NULL); + DOMElement* rootElement = NULL; try { - rootElement=assertion->marshall((DOMDocument*)NULL,&sigs); + rootElement=assertion->marshall((DOMDocument*)NULL,&sigs,cred); } catch (XMLToolingException& e) { TS_TRACE(e.what()); @@ -97,8 +94,8 @@ public: assertEquals("Unmarshalled assertion does not match", expectedChildElementsDOM, assertion2.get(), false); try { - SignatureProfileValidator spv; - SignatureValidator sv(new KeyResolver(m_resolver->getKey())); + opensaml::SignatureProfileValidator spv; + SignatureValidator sv(cred); spv.validate(dynamic_cast(assertion2.get())->getSignature()); sv.validate(dynamic_cast(assertion2.get())->getSignature()); }