mace-opensaml-users - org.opensaml.xml.XMLRuntimeException: DOM Element node adoption failed thrown when signing the assertion
Subject: OpenSAML user discussion
List archive
org.opensaml.xml.XMLRuntimeException: DOM Element node adoption failed thrown when signing the assertion
Chronological Thread
- From: Thilina Mahesh Buddhika <>
- To:
- Subject: org.opensaml.xml.XMLRuntimeException: DOM Element node adoption failed thrown when signing the assertion
- Date: Tue, 14 Jul 2009 20:00:11 +0530
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=pmy9Xdt1cKIKFOOqPDEVPjPiFwXuvilb7QJ0o/geoSs+CIQNCk0U3Val37cBduUZqR udS6ShNaCT0pjwiRtOl10zHdatcrQ1F5Y4zciF2Qee3a5MTeIxPeofISa47I8ZHdNEyF c5HEofiVcH+7bMfCBuMN3q1HJUkub8ECs/wfA=
hi all,
I am trying to sign a SAML 2.0 assertion built using OpenSAML2.0 library. In this assertion, I am using holder-of-key subject confirmation method. In subjectConfirmationData element, I am adding a <ds:keyInfo> element to it. I use Axiom to build this keyInfo element. Then I am unmarshelling that keyinfo element to an XMLObject by using the following code snippet.
---------------------------------------------------------------------------------
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(keyInfoElem);
// Unmarshall using the document root element, an EntitiesDescriptor in this case
XMLObject keyInfoElement = null;
try {
keyInfoElement = unmarshaller.unmarshall(keyInfoElem);
} catch (UnmarshallingException e) {
throw new TrustException("Error unmarshalling KeyInfo Element", e);
}
----------------------------------------------------------------------
Then I am adding this element into a KeyInfoConfirmationDataType element.
When I am trying to sign the resulting SAML assertion I am hitting with an exception as stated in subject. The StackTrace is as follows.
org.opensaml.xml.XMLRuntimeException: DOM Element node adoption failed
at org.opensaml.xml.util.XMLHelper.adoptElement(XMLHelper.java:482)
at org.opensaml.xml.util.XMLHelper.appendChildElement(XMLHelper.java:467)
at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:161)
at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshallChildElements(AbstractXMLObjectMarshaller.java:316)
at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshallInto(AbstractXMLObjectMarshaller.java:224)
at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:175)
at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshallChildElements(AbstractXMLObjectMarshaller.java:316)
at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshallInto(AbstractXMLObjectMarshaller.java:224)
at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:175)
at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshallChildElements(AbstractXMLObjectMarshaller.java:316)
at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshallInto(AbstractXMLObjectMarshaller.java:224)
at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:175)
at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshallChildElements(AbstractXMLObjectMarshaller.java:316)
at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshallInto(AbstractXMLObjectMarshaller.java:224)
at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:130)
at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:86)
at org.apache.rahas.impl.SAML2TokenIssuer.setSignature(SAML2TokenIssuer.java:461)
When I went through the code of XMLHelper, I found that this error is due to the use of two different dom implementations of adaper and adaptee elements.
/**
* Adopts an element into a document if the child is not already in the document.
*
* @param adoptee the element to be adopted
* @param adopter the document into which the element is adopted
*/
public static void adoptElement(Element adoptee, Document adopter) {
if (!(adoptee.getOwnerDocument().equals(adopter))) {
if (adopter.adoptNode(adoptee) == null) {
// This can happen if the adopter and adoptee were produced by different DOM implementations
throw new XMLRuntimeException("DOM Element node adoption failed");
}
}
}
I guess this is due to the fact that I am using axiom to build the keyInfo element. Due to some constraints, I am keen on keeping the Axiom involvement as it is.
Is there any workaround for this ?
Thanks in advance.
best regards,
/thilina
E-Mail :
I blog here : http://thilinamb.com
- org.opensaml.xml.XMLRuntimeException: DOM Element node adoption failed thrown when signing the assertion, Thilina Mahesh Buddhika, 07/14/2009
- Re: [OpenSAML] org.opensaml.xml.XMLRuntimeException: DOM Element node adoption failed thrown when signing the assertion, Chad La Joie, 07/14/2009
- Re: [OpenSAML] org.opensaml.xml.XMLRuntimeException: DOM Element node adoption failed thrown when signing the assertion, Thilina Mahesh Buddhika, 07/15/2009
- Re: [OpenSAML] org.opensaml.xml.XMLRuntimeException: DOM Element node adoption failed thrown when signing the assertion, Chad La Joie, 07/14/2009
Archive powered by MHonArc 2.6.16.