<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 4/26/17 9:39 PM, Locatelli da Silva,
Thiago wrote:<br>
</div>
<blockquote type="cite"
cite="mid:D526BC12.D6C3%25thiago.locatellidasilva@transamerica.com">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<div>
<div>This is how I am signing the assertion:</div>
<div><br>
</div>
<div>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
<span style="color: #931a68">private</span> Assertion
createSignedAssertion()
<span style="color: #931a68">throws</span> SamlException {</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
<span style="color: #931a68">try</span> {</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco; min-height: 15px;">
</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
Signature <span style="color: #7e504f">signature</span>
= createSignature();</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
Assertion <span style="color: #7e504f">assertion</span>
= createAssertion();</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
<span style="color: #7e504f">assertion</span>.setSignature(<span
style="color: #7e504f">signature</span>);</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco; min-height: 15px;">
<br>
</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
MarshallerFactory <span style="color: #7e504f">marshallerFactory</span>
= XMLObjectProviderRegistrySupport.getMarshallerFactory();</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
<span style="color: #7e504f">marshallerFactory</span>.getMarshaller(<span
style="color: #7e504f">assertion</span>).marshall(<span
style="color: #7e504f">assertion</span>);</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
Signer.signObject(<span style="color: #7e504f">signature</span>);</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco; min-height: 15px;">
<br>
</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
UnmarshallerFactory <span style="color:
#7e504f">unmarshallerFactory</span> =
XMLObjectProviderRegistrySupport.getUnmarshallerFactory();</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
Assertion <span style="color: #7e504f">signedAssertion</span>
= (Assertion)
<span style="color: #7e504f">unmarshallerFactory</span>.getUnmarshaller(<span
style="color: #7e504f">assertion</span>.getDOM()).unmarshall(<span
style="color: #7e504f">assertion</span>.getDOM());</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco; min-height: 15px;">
<br>
</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco; color: rgb(126, 80, 79);">
<span style="color: #000000"> </span><span
style="color: #931a68">return</span><span style="color:
#000000">
</span>signedAssertion<span style="color: #000000">;</span></p>
</div>
</div>
</blockquote>
<br>
The only thing that looks odd or unusual in your code so far is what
you are doing above to unmarshall a new Assertion object after
you've signed the input Assertion. You don't in general have to do
that. You just sign it as you are doing and then make use of the
existing Assertion instance. It's already signed. I don't know
off-hand if what you are doing could be screwing up the XML
namespaces per the exception, but it could be, as it certainly is
related to the DOM instances that are cached on the objects.<br>
<br>
I would suggest to try just commenting out those two unmarshalling
lines above and just return the 'assertion' instance.<br>
<br>
</body>
</html>