/*
- * Copyright 2001-2006 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.
#include "saml2/core/Protocols.h"
#include <xmltooling/AbstractComplexElement.h>
-#include <xmltooling/AbstractElementProxy.h>
#include <xmltooling/AbstractSimpleElement.h>
#include <xmltooling/encryption/Decrypter.h>
#include <xmltooling/impl/AnyElement.h>
using namespace opensaml::saml2p;
using namespace opensaml::saml2;
-using namespace opensaml;
using namespace xmlsignature;
using namespace xmlencryption;
using namespace xmltooling;
//TODO need unit test for this, using objects from another namespace
class SAML_DLLLOCAL ExtensionsImpl : public virtual Extensions,
- public AbstractElementProxy,
+ public AbstractComplexElement,
public AbstractDOMCachingXMLObject,
public AbstractXMLObjectMarshaller,
public AbstractXMLObjectUnmarshaller
}
ExtensionsImpl(const ExtensionsImpl& src)
- : AbstractXMLObject(src), AbstractElementProxy(src), AbstractDOMCachingXMLObject(src) {
- for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
- if (*i) {
- getXMLObjects().push_back((*i)->clone());
- }
- }
+ : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
+ VectorOf(XMLObject) v=getUnknownXMLObjects();
+ for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
+ v.push_back((*i)->clone());
}
IMPL_XMLOBJECT_CLONE(Extensions);
+ IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
protected:
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
// Unknown child.
const XMLCh* nsURI=root->getNamespaceURI();
if (!XMLString::equals(nsURI,SAML20P_NS) && nsURI && *nsURI) {
- getXMLObjects().push_back(childXMLObject);
+ getUnknownXMLObjects().push_back(childXMLObject);
return;
}
StatusDetailImpl(const StatusDetailImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
- VectorOf(XMLObject) v=getDetails();
- for (vector<XMLObject*>::const_iterator i=src.m_Details.begin(); i!=src.m_Details.end(); i++) {
- if (*i) {
- v.push_back((*i)->clone());
- }
- }
+ VectorOf(XMLObject) v=getUnknownXMLObjects();
+ for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
+ v.push_back((*i)->clone());
}
IMPL_XMLOBJECT_CLONE(StatusDetail);
- IMPL_XMLOBJECT_CHILDREN(Detail,m_children.end());
+ IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
protected:
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- getDetails().push_back(childXMLObject);
- AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+ getUnknownXMLObjects().push_back(childXMLObject);
}
};
ResponseImpl(const ResponseImpl& src) : AbstractXMLObject(src), StatusResponseTypeImpl(src) {
for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
if (*i) {
- Assertion* assertion=dynamic_cast<Assertion*>(*i);
+ saml2::Assertion* assertion=dynamic_cast<saml2::Assertion*>(*i);
if (assertion) {
getAssertions().push_back(assertion->cloneAssertion());
continue;
}
}
- XMLObject* decrypt(KeyResolver* KEKresolver, const XMLCh* recipient) const
+ XMLObject* decrypt(const CredentialResolver& credResolver, const XMLCh* recipient, CredentialCriteria* criteria) const
{
if (!m_EncryptedData)
throw DecryptionException("No encrypted data present.");
- Decrypter decrypter(KEKresolver, new EncryptedKeyResolver(*this, recipient));
- DOMDocumentFragment* frag = decrypter.decryptData(m_EncryptedData);
+ EncryptedKeyResolver ekr(*this);
+ Decrypter decrypter(&credResolver, criteria, &ekr);
+ DOMDocumentFragment* frag = decrypter.decryptData(*m_EncryptedData, recipient);
if (frag->hasChildNodes() && frag->getFirstChild()==frag->getLastChild()) {
DOMNode* plaintext=frag->getFirstChild();
if (plaintext->getNodeType()==DOMNode::ELEMENT_NODE) {