-/*
- * Copyright 2001-2010 Internet2
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * UCAID licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the
+ * License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
*/
/**
NameIDTypeImpl(const NameIDTypeImpl& src)
: AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
init();
+ }
+
+ void _clone(const NameIDTypeImpl& src) {
setNameQualifier(src.getNameQualifier());
setSPNameQualifier(src.getSPNameQualifier());
setFormat(src.getFormat());
setSPProvidedID(src.getSPProvidedID());
}
- IMPL_XMLOBJECT_CLONE(NameIDType);
+ IMPL_XMLOBJECT_CLONE_EX(NameIDType);
IMPL_STRING_ATTRIB(NameQualifier);
IMPL_STRING_ATTRIB(SPNameQualifier);
IMPL_STRING_ATTRIB(Format);
NameIDImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
: AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
- NameIDImpl(const NameIDImpl& src) : AbstractXMLObject(src), NameIDTypeImpl(src) {}
-
- IMPL_XMLOBJECT_CLONE(NameID);
- NameIDType* cloneNameIDType() const {
- return new NameIDImpl(*this);
+ NameIDImpl(const NameIDImpl& src) : AbstractXMLObject(src), NameIDTypeImpl(src) {
}
+
+ IMPL_XMLOBJECT_CLONE_EX(NameID);
};
class SAML_DLLLOCAL IssuerImpl : public virtual Issuer, public NameIDTypeImpl
IssuerImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
: AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
- IssuerImpl(const IssuerImpl& src) : AbstractXMLObject(src), NameIDTypeImpl(src) {}
-
- IMPL_XMLOBJECT_CLONE(Issuer);
- NameIDType* cloneNameIDType() const {
- return new IssuerImpl(*this);
+ IssuerImpl(const IssuerImpl& src) : AbstractXMLObject(src), NameIDTypeImpl(src) {
}
+
+ IMPL_XMLOBJECT_CLONE_EX(Issuer);
};
//TODO unit test for this
EncryptedElementTypeImpl(const EncryptedElementTypeImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
+ }
+
+ void _clone(const EncryptedElementTypeImpl& src) {
if (src.getEncryptedData())
setEncryptedData(src.getEncryptedData()->cloneEncryptedData());
- VectorOf(EncryptedKey) v=getEncryptedKeys();
for (vector<EncryptedKey*>::const_iterator i=src.m_EncryptedKeys.begin(); i!=src.m_EncryptedKeys.end(); i++) {
if (*i) {
- v.push_back((*i)->cloneEncryptedKey());
+ getEncryptedKeys().push_back((*i)->cloneEncryptedKey());
}
}
}
- IMPL_XMLOBJECT_CLONE(EncryptedElementType);
+ IMPL_XMLOBJECT_CLONE_EX(EncryptedElementType);
IMPL_TYPED_FOREIGN_CHILD(EncryptedData,xmlencryption);
IMPL_TYPED_FOREIGN_CHILDREN(EncryptedKey,xmlencryption,m_children.end());
EncryptedIDImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
: AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
- EncryptedIDImpl(const EncryptedIDImpl& src) : AbstractXMLObject(src), EncryptedElementTypeImpl(src) {}
-
- IMPL_XMLOBJECT_CLONE(EncryptedID);
- EncryptedElementType* cloneEncryptedElementType() const {
- return new EncryptedIDImpl(*this);
+ EncryptedIDImpl(const EncryptedIDImpl& src) : AbstractXMLObject(src), EncryptedElementTypeImpl(src) {
}
+
+ IMPL_XMLOBJECT_CLONE_EX(EncryptedID);
};
class SAML_DLLLOCAL ConditionImpl : public virtual Condition, public AnyElementImpl
AudienceRestrictionImpl(const AudienceRestrictionImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
- VectorOf(Audience) v=getAudiences();
for (vector<Audience*>::const_iterator i=src.m_Audiences.begin(); i!=src.m_Audiences.end(); i++) {
if (*i) {
- v.push_back((*i)->cloneAudience());
+ getAudiences().push_back((*i)->cloneAudience());
}
}
}
- IMPL_XMLOBJECT_CLONE(AudienceRestriction);
- Condition* cloneCondition() const {
- return cloneAudienceRestriction();
- }
+ IMPL_XMLOBJECT_CLONE2(AudienceRestriction,Condition);
IMPL_TYPED_CHILDREN(Audience,m_children.end());
protected:
: AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
}
- IMPL_XMLOBJECT_CLONE(OneTimeUse);
- Condition* cloneCondition() const {
- return cloneOneTimeUse();
- }
+ IMPL_XMLOBJECT_CLONE2(OneTimeUse,Condition);
};
class SAML_DLLLOCAL ProxyRestrictionImpl : public virtual ProxyRestriction,
}
ProxyRestrictionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
- : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
- m_Count=nullptr;
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_Count(nullptr) {
}
ProxyRestrictionImpl(const ProxyRestrictionImpl& src)
- : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
+ : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src), m_Count(nullptr) {
setCount(src.m_Count);
- VectorOf(Audience) v=getAudiences();
for (vector<Audience*>::const_iterator i=src.m_Audiences.begin(); i!=src.m_Audiences.end(); i++) {
if (*i) {
- v.push_back((*i)->cloneAudience());
+ getAudiences().push_back((*i)->cloneAudience());
}
}
}
- IMPL_XMLOBJECT_CLONE(ProxyRestriction);
- Condition* cloneCondition() const {
- return cloneProxyRestriction();
- }
+ IMPL_XMLOBJECT_CLONE2(ProxyRestriction,Condition);
IMPL_TYPED_CHILDREN(Audience,m_children.end());
IMPL_INTEGER_ATTRIB(Count);
m_pos_EncryptedID=m_pos_NameID;
++m_pos_EncryptedID;
}
+
public:
virtual ~DelegateImpl() {
XMLString::release(&m_ConfirmationMethod);
DelegationRestrictionTypeImpl(const DelegationRestrictionTypeImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
- VectorOf(Delegate) v=getDelegates();
for (vector<Delegate*>::const_iterator i=src.m_Delegates.begin(); i!=src.m_Delegates.end(); i++) {
if (*i) {
- v.push_back((*i)->cloneDelegate());
+ getDelegates().push_back((*i)->cloneDelegate());
}
}
}
- IMPL_XMLOBJECT_CLONE(DelegationRestrictionType);
- Condition* cloneCondition() const {
- return cloneDelegationRestrictionType();
- }
+ IMPL_XMLOBJECT_CLONE2(DelegationRestrictionType,Condition);
IMPL_TYPED_CHILDREN(Delegate,m_children.end());
protected:
void init() {
m_NotBefore=m_NotOnOrAfter=nullptr;
}
+
public:
virtual ~ConditionsImpl() {
delete m_NotBefore;
SubjectConfirmationDataTypeImpl(const SubjectConfirmationDataTypeImpl& src) : AbstractXMLObject(src) {
init();
+ }
+
+ void _clone(const SubjectConfirmationDataTypeImpl& src) {
setNotBefore(src.getNotBefore());
setNotOnOrAfter(src.getNotOnOrAfter());
setRecipient(src.getRecipient());
setAddress(src.getAddress());
}
+ SubjectConfirmationDataType* cloneSubjectConfirmationDataType() const {
+ return dynamic_cast<SubjectConfirmationDataType*>(clone());
+ }
+
IMPL_DATETIME_ATTRIB(NotBefore,0);
IMPL_DATETIME_ATTRIB(NotOnOrAfter,SAMLTIME_MAX);
IMPL_STRING_ATTRIB(Recipient);
virtual ~SubjectConfirmationDataImpl() {}
SubjectConfirmationDataImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
- : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
}
SubjectConfirmationDataImpl(const SubjectConfirmationDataImpl& src)
- : AbstractXMLObject(src), SubjectConfirmationDataTypeImpl(src), AnyElementImpl(src) {
+ : AbstractXMLObject(src), SubjectConfirmationDataTypeImpl(src), AnyElementImpl(src) {
}
- IMPL_XMLOBJECT_CLONE(SubjectConfirmationData);
- SubjectConfirmationDataType* cloneSubjectConfirmationDataType() const {
- return new SubjectConfirmationDataImpl(*this);
+ void _clone(const SubjectConfirmationDataImpl& src) {
+ SubjectConfirmationDataTypeImpl::_clone(src);
+ AnyElementImpl::_clone(src);
}
+ IMPL_XMLOBJECT_CLONE_EX(SubjectConfirmationData);
+
void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
if (!qualifiedName.hasNamespaceURI()) {
if (XMLString::equals(qualifiedName.getLocalPart(),NOTBEFORE_ATTRIB_NAME)) {
virtual ~KeyInfoConfirmationDataTypeImpl() {}
KeyInfoConfirmationDataTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
- : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
}
KeyInfoConfirmationDataTypeImpl(const KeyInfoConfirmationDataTypeImpl& src)
- : AbstractXMLObject(src), SubjectConfirmationDataTypeImpl(src), AbstractComplexElement(src),
- AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
- VectorOf(KeyInfo) v=getKeyInfos();
- for (vector<KeyInfo*>::const_iterator i=src.m_KeyInfos.begin(); i!=src.m_KeyInfos.end(); ++i)
- v.push_back((*i)->cloneKeyInfo());
+ : AbstractXMLObject(src), SubjectConfirmationDataTypeImpl(src), AbstractComplexElement(src),
+ AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
}
- IMPL_XMLOBJECT_CLONE(KeyInfoConfirmationDataType);
- SubjectConfirmationDataType* cloneSubjectConfirmationDataType() const {
- return new KeyInfoConfirmationDataTypeImpl(*this);
+ void _clone(const KeyInfoConfirmationDataTypeImpl& src) {
+ SubjectConfirmationDataTypeImpl::_clone(src);
+ for (vector<KeyInfo*>::const_iterator i=src.m_KeyInfos.begin(); i!=src.m_KeyInfos.end(); ++i) {
+ if (*i) {
+ getKeyInfos().push_back((*i)->cloneKeyInfo());
+ }
+ }
}
+ IMPL_XMLOBJECT_CLONE_EX(KeyInfoConfirmationDataType);
IMPL_TYPED_CHILDREN(KeyInfo,m_children.end());
public:
m_pos_SubjectConfirmationData=m_pos_EncryptedID;
++m_pos_SubjectConfirmationData;
}
+
public:
- virtual ~SubjectConfirmationImpl() {}
+ virtual ~SubjectConfirmationImpl() {
+ XMLString::release(&m_Method);
+ }
SubjectConfirmationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
: AbstractXMLObject(nsURI, localName, prefix, schemaType) {
m_pos_EncryptedID=m_pos_NameID;
++m_pos_EncryptedID;
}
+
public:
virtual ~SubjectImpl() {}
setNameID(src.getNameID()->cloneNameID());
if (src.getEncryptedID())
setEncryptedID(src.getEncryptedID()->cloneEncryptedID());
- VectorOf(SubjectConfirmation) v=getSubjectConfirmations();
for (vector<SubjectConfirmation*>::const_iterator i=src.m_SubjectConfirmations.begin(); i!=src.m_SubjectConfirmations.end(); i++) {
if (*i) {
- v.push_back((*i)->cloneSubjectConfirmation());
+ getSubjectConfirmations().push_back((*i)->cloneSubjectConfirmation());
}
}
}
void init() {
m_Address=m_DNSName=nullptr;
}
+
public:
virtual ~SubjectLocalityImpl() {
XMLString::release(&m_Address);
StatementImpl(const StatementImpl& src) : AbstractXMLObject(src), AnyElementImpl(src) {}
- IMPL_XMLOBJECT_CLONE(Statement);
+ IMPL_XMLOBJECT_CLONE_EX(Statement);
};
//TODO need unit test for this
AuthnContextDeclImpl(const AuthnContextDeclImpl& src) : AbstractXMLObject(src), AnyElementImpl(src) {
}
- IMPL_XMLOBJECT_CLONE(AuthnContextDecl);
+ IMPL_XMLOBJECT_CLONE_EX(AuthnContextDecl);
};
class SAML_DLLLOCAL AuthnContextImpl : public virtual AuthnContext,
m_pos_AuthnContextDeclRef=m_pos_AuthnContextDecl;
++m_pos_AuthnContextDeclRef;
}
+
public:
virtual ~AuthnContextImpl() {}
setAuthnContextDecl(src.getAuthnContextDecl()->clone());
if (src.getAuthnContextDeclRef())
setAuthnContextDeclRef(src.getAuthnContextDeclRef()->cloneAuthnContextDeclRef());
- VectorOf(AuthenticatingAuthority) v=getAuthenticatingAuthoritys();
for (vector<AuthenticatingAuthority*>::const_iterator i=src.m_AuthenticatingAuthoritys.begin(); i!=src.m_AuthenticatingAuthoritys.end(); i++) {
if (*i) {
- v.push_back((*i)->cloneAuthenticatingAuthority());
+ getAuthenticatingAuthoritys().push_back((*i)->cloneAuthenticatingAuthority());
}
}
}
m_pos_AuthnContext=m_pos_SubjectLocality;
++m_pos_AuthnContext;
}
+
public:
virtual ~AuthnStatementImpl() {
delete m_AuthnInstant;
setAuthnContext(src.getAuthnContext()->cloneAuthnContext());
}
- IMPL_XMLOBJECT_CLONE(AuthnStatement);
- Statement* cloneStatement() const {
- return cloneAuthnStatement();
- }
+ IMPL_XMLOBJECT_CLONE2(AuthnStatement,Statement);
IMPL_DATETIME_ATTRIB(AuthnInstant,0);
IMPL_STRING_ATTRIB(SessionIndex);
IMPL_DATETIME_ATTRIB(SessionNotOnOrAfter,SAMLTIME_MAX);
}
ActionImpl(const ActionImpl& src)
- : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
+ : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src), m_Namespace(nullptr) {
setNamespace(src.getNamespace());
}
m_children.push_back(nullptr);
m_pos_Evidence=m_children.begin();
}
+
public:
virtual ~AuthzDecisionStatementImpl() {
XMLString::release(&m_Resource);
setDecision(src.getDecision());
if (src.getEvidence())
setEvidence(src.getEvidence()->cloneEvidence());
- VectorOf(Action) v=getActions();
for (vector<Action*>::const_iterator i=src.m_Actions.begin(); i!=src.m_Actions.end(); i++) {
if (*i) {
- v.push_back((*i)->cloneAction());
+ getActions().push_back((*i)->cloneAction());
}
}
}
- IMPL_XMLOBJECT_CLONE(AuthzDecisionStatement);
- Statement* cloneStatement() const {
- return cloneAuthzDecisionStatement();
- }
+ IMPL_XMLOBJECT_CLONE2(AuthzDecisionStatement,Statement);
IMPL_STRING_ATTRIB(Resource);
IMPL_STRING_ATTRIB(Decision);
IMPL_TYPED_CHILD(Evidence);
AttributeValueImpl(const AttributeValueImpl& src) : AbstractXMLObject(src), AnyElementImpl(src) {
}
- IMPL_XMLOBJECT_CLONE(AttributeValue);
+ IMPL_XMLOBJECT_CLONE_EX(AttributeValue);
};
void init() {
m_Name=m_NameFormat=m_FriendlyName=nullptr;
}
+
public:
virtual ~AttributeImpl() {
XMLString::release(&m_Name);
setName(src.getName());
setNameFormat(src.getNameFormat());
setFriendlyName(src.getFriendlyName());
- VectorOf(XMLObject) v=getAttributeValues();
for (vector<XMLObject*>::const_iterator i=src.m_AttributeValues.begin(); i!=src.m_AttributeValues.end(); i++) {
if (*i) {
- v.push_back((*i)->clone());
+ getAttributeValues().push_back((*i)->clone());
}
}
}
EncryptedAttributeImpl(const EncryptedAttributeImpl& src) : AbstractXMLObject(src), EncryptedElementTypeImpl(src) {}
- IMPL_XMLOBJECT_CLONE(EncryptedAttribute);
- EncryptedElementType* cloneEncryptedElementType() const {
- return new EncryptedAttributeImpl(*this);
- }
+ IMPL_XMLOBJECT_CLONE_EX(EncryptedAttribute);
};
class SAML_DLLLOCAL AttributeStatementImpl : public virtual AttributeStatement,
}
}
- IMPL_XMLOBJECT_CLONE(AttributeStatement);
- Statement* cloneStatement() const {
- return cloneAttributeStatement();
- }
+ IMPL_XMLOBJECT_CLONE2(AttributeStatement,Statement);
IMPL_TYPED_CHILDREN(Attribute, m_children.end());
IMPL_TYPED_CHILDREN(EncryptedAttribute, m_children.end());
continue;
}
- getUnknownXMLObjects().push_back((*i)->clone());
+ if (*i) {
+ getUnknownXMLObjects().push_back((*i)->clone());
+ }
}
}
}
EncryptedAssertionImpl(const EncryptedAssertionImpl& src) : AbstractXMLObject(src), EncryptedElementTypeImpl(src) {}
- IMPL_XMLOBJECT_CLONE(EncryptedAssertion);
- EncryptedElementType* cloneEncryptedElementType() const {
- return new EncryptedAssertionImpl(*this);
- }
+ IMPL_XMLOBJECT_CLONE_EX(EncryptedAssertion);
};
class SAML_DLLLOCAL AssertionImpl : public virtual Assertion,
m_pos_Advice=m_pos_Conditions;
++m_pos_Advice;
}
+
public:
virtual ~AssertionImpl() {
XMLString::release(&m_ID);
IMPL_TYPED_CHILDREN(AuthzDecisionStatement, m_children.end());
protected:
+ void prepareForMarshalling() const {
+ if (m_Signature)
+ declareNonVisibleNamespaces();
+ }
+
void marshallAttributes(DOMElement* domElement) const {
if (!m_Version)
const_cast<AssertionImpl*>(this)->m_Version=XMLString::transcode("2.0");