<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi,</p>
<p>I'm very close to being able to build a simple SAML IDP Response
XML that can be HTTP POST'ed to a SP (IDP-initiated SSO).</p>
<p>I'm now able to build the main XML body, complete with
assertions, but can't seem to get signing to work :(</p>
<p>I'm getting a cast exception,
"org.opensaml.saml.saml2.core.impl.IssuerImpl cannot be cast to
org.opensaml.core.xml.schema.XSAny" when I try and do the final
line of the below code ( <font face="monospace">marshaller.marshall(assertion)
)</font>.</p>
<p>I assume something is missing upstream of here, either in my
configuration ( ConfigurationService ? ) or the code that builds
the assertion itself, but don't really know where I might need to
start looking. <br>
</p>
<p>Any ideas ?<br>
</p>
<p><font face="monospace">// ... already have an "assertion"
variable of type org.opensaml.saml.saml2.core.Assertion ...<br>
</font></p>
<p><font face="monospace">SignatureBuilder builder = new
SignatureBuilder();<br>
Signature signature = builder.buildObject();<br>
<br>
signature.setSigningCredential(signingCredential);<br>
signature.setSignatureAlgorithm(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256);<br>
signature.setCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);<br>
<br>
assertion.setSignature(signature);<br>
</font></p>
<p><font face="monospace">AssertionMarshaller marshaller = new
AssertionMarshaller();<br>
marshaller.marshall(assertion); <br>
</font></p>
<p>The full stack trace from there is <br>
</p>
<p><font face="monospace">
org.opensaml.saml.saml2.core.impl.IssuerImpl cannot be cast to
org.opensaml.core.xml.schema.XSAny<br>
<span style="margin-right: 1em;"> </span> at
org.opensaml.core.xml.schema.impl.XSAnyMarshaller.marshallAttributes(XSAnyMarshaller.java:45)<br>
<span style="margin-right: 1em;"> </span> at
org.opensaml.core.xml.io.AbstractXMLObjectMarshaller.marshallInto(AbstractXMLObjectMarshaller.java:210)<br>
<span style="margin-right: 1em;"> </span> at
org.opensaml.core.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:162)<br>
<span style="margin-right: 1em;"> </span> at
org.opensaml.core.xml.io.AbstractXMLObjectMarshaller.marshallChildElements(AbstractXMLObjectMarshaller.java:271)<br>
<span style="margin-right: 1em;"> </span> at
org.opensaml.core.xml.io.AbstractXMLObjectMarshaller.marshallInto(AbstractXMLObjectMarshaller.java:212)<br>
<span style="margin-right: 1em;"> </span> at
org.opensaml.core.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:118)<br>
<span style="margin-right: 1em;"> </span> at
org.opensaml.saml.common.AbstractSAMLObjectMarshaller.marshall(AbstractSAMLObjectMarshaller.java:57)<br>
<span style="margin-right: 1em;"> </span> at
org.opensaml.core.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:75)</font></p>
<div class="moz-signature">
<meta charset="UTF-8">
<title>Tom Chiverton</title>
<style type="text/css">
a, a:visited
{font-family:Palatino, 'Palatino Linotype', 'Palatino LT STD', Georgia, Serif; color:#3bb3e2; text-decoration:none !important;}
a[x-apple-data-detectors]
{color: inherit !important; text-decoration: none !important; font-size: inherit !important; font-family: inherit !important; font-weight: inherit !important; line-height: inherit !important;}
.appleLinks a
{text-decoration:none !important;}
</style>
<!--[if gte mso 9]>
<style type="text/css">
a, a:visited {font-family:Palatino, 'Palatino Linotype', 'Palatino LT STD', Georgia, Serif; color:#3bb3e2; text-decoration:none !important;}
</style>
<![endif]--> --
<table style="max-width:600px;" width="100%" cellspacing="0"
cellpadding="0" border="0" bgcolor="#FFFFFF">
<tbody>
<tr>
<td style="line-height:20px; font-size:20px;" height="20"> </td>
</tr>
<tr>
<td style="mso-line-height-rule:exactly; line-height:1px;
font-size:1px;" height="1" bgcolor="#f2f5f7"><img
src="https://extravision.s3.eu-west-1.amazonaws.com/images/blank.gif"
style="display:block;" alt="" width="1" height="1"></td>
</tr>
<tr>
<td style="line-height:20px; font-size:20px;" height="20"> </td>
</tr>
<tr>
<td width="100%" valign="top">
<table width="100%" cellspacing="0" cellpadding="0"
border="0">
<tbody>
<tr>
<td style="font-family:Palatino, 'Palatino
Linotype', 'Palatino LT STD', Georgia, Serif;
color:#4f5354; font-size:15px; line-height:18px;"
width="100%" valign="top" align="left"> <strong>Tom
Chiverton</strong><br>
Lead Developer </td>
</tr>
<tr>
<td style="line-height:20px; font-size:20px;"
height="20"> </td>
</tr>
<tr>
<td valign="top" align="left">
<table width="250" cellspacing="0" cellpadding="0"
border="0">
<tbody>
<tr>
<td style="font-family:Palatino, 'Palatino
Linotype', 'Palatino LT STD', Georgia,
Serif; color:#3bb3e2; font-size:15px;
line-height:22px; text-decoration:none;"
width="30" valign="top" align="left">e:</td>
<td style="font-family:Palatino, 'Palatino
Linotype', 'Palatino LT STD', Georgia,
Serif; color:#4f5354; font-size:15px;
line-height:22px;" width="220"
valign="top" align="left"><a
href="mailto:tc@extravision.com"
style="font-family:Palatino, 'Palatino
Linotype', 'Palatino LT STD', Georgia,
Serif; color:#4f5354; font-size:15px;
text-decoration:none !important;">tc@extravision.com</a></td>
</tr>
<tr>
<td style="font-family:Palatino, 'Palatino
Linotype', 'Palatino LT STD', Georgia,
Serif; color:#3bb3e2; font-size:15px;
line-height:22px; text-decoration:none;"
valign="top" align="left">p:</td>
<td style="font-family:Palatino, 'Palatino
Linotype', 'Palatino LT STD', Georgia,
Serif; color:#4f5354; font-size:15px;
line-height:22px;" valign="top"
align="left">0161 817 2929</td>
</tr>
<tr>
<td style="font-family:Palatino, 'Palatino
Linotype', 'Palatino LT STD', Georgia,
Serif; color:#3bb3e2; font-size:15px;
line-height:22px; text-decoration:none;"
valign="top" align="left">t:</td>
<td style="font-family:Palatino, 'Palatino
Linotype', 'Palatino LT STD', Georgia,
Serif; color:#4f5354; font-size:15px;
line-height:22px;" valign="top"
align="left">@extravision</td>
</tr>
<tr>
<td style="font-family:Palatino, 'Palatino
Linotype', 'Palatino LT STD', Georgia,
Serif; color:#3bb3e2; font-size:15px;
line-height:22px; text-decoration:none;"
valign="top" align="left">w:</td>
<td style="font-family:Palatino, 'Palatino
Linotype', 'Palatino LT STD', Georgia,
Serif; color:#4f5354; font-size:15px;
line-height:22px;" valign="top"
align="left">extravision.com</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="line-height:20px; font-size:20px;"
height="20"> </td>
</tr>
<tr>
<td width="100%" valign="top">
<table width="200" cellspacing="0" cellpadding="0"
border="0">
<tbody>
<tr>
<td width="200" valign="top" align="left"> <a
href="https://www.extravision.com"
target="_blank"><img
src="https://extravision.s3.eu-west-1.amazonaws.com/images/extravision-logo-on-light.png"
style="display:block;"
alt="Extravision" width="200"
height="31" border="0"></a> </td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="line-height:20px; font-size:20px;"
height="20"> </td>
</tr>
<tr>
<td valign="top" align="left">
<table width="100%" cellspacing="0"
cellpadding="0" border="0">
<tbody>
<tr>
<td style="font-family:Palatino, 'Palatino
Linotype', 'Palatino LT STD', Georgia,
Serif; color:#4f5354; font-size:12px;
line-height:16px;" width="100%"
valign="top" align="left"> Registered in
the UK at: Tomorrow, MediaCityUK,
Salford M50 2AB.<br>
Company Reg No: 05017214 VAT: GB 824
5386 19<br>
<br>
This e-mail is intended solely for the
person to whom it is addressed and may
contain confidential or privileged
information. Any views or opinions
presented in this e-mail are solely of the
author and do not necessarily represent
those of Extravision Ltd. </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<br clear="both">
______________________________________________________________________<BR>
This email has been scanned by the Symantec Email Security.cloud service.<BR>
For more information please visit http://www.symanteccloud.com<BR>
______________________________________________________________________<BR>
</body>
</html>