ClassCastException : IssuerImpl to XSAny
Tom Chiverton
tc at extravision.com
Thu Jun 17 10:15:01 UTC 2021
Hi,
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).
I'm now able to build the main XML body, complete with assertions, but
can't seem to get signing to work :(
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 ( marshaller.marshall(assertion) ).
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.
Any ideas ?
// ... already have an "assertion" variable of type
org.opensaml.saml.saml2.core.Assertion ...
SignatureBuilder builder = new SignatureBuilder();
Signature signature = builder.buildObject();
signature.setSigningCredential(signingCredential);
signature.setSignatureAlgorithm(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256);
signature.setCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
assertion.setSignature(signature);
AssertionMarshaller marshaller = new AssertionMarshaller();
marshaller.marshall(assertion);
The full stack trace from there is
org.opensaml.saml.saml2.core.impl.IssuerImpl cannot be cast to
org.opensaml.core.xml.schema.XSAny
at
org.opensaml.core.xml.schema.impl.XSAnyMarshaller.marshallAttributes(XSAnyMarshaller.java:45)
at
org.opensaml.core.xml.io.AbstractXMLObjectMarshaller.marshallInto(AbstractXMLObjectMarshaller.java:210)
at
org.opensaml.core.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:162)
at
org.opensaml.core.xml.io.AbstractXMLObjectMarshaller.marshallChildElements(AbstractXMLObjectMarshaller.java:271)
at
org.opensaml.core.xml.io.AbstractXMLObjectMarshaller.marshallInto(AbstractXMLObjectMarshaller.java:212)
at
org.opensaml.core.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:118)
at
org.opensaml.saml.common.AbstractSAMLObjectMarshaller.marshall(AbstractSAMLObjectMarshaller.java:57)
at
org.opensaml.core.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:75)
Tom Chiverton --
*Tom Chiverton*
Lead Developer
e: tc at extravision.com <mailto:tc at extravision.com>
p: 0161 817 2929
t: @extravision
w: extravision.com
Extravision <https://www.extravision.com>
Registered in the UK at: Tomorrow, MediaCityUK, Salford M50 2AB.
Company Reg No: 05017214 VAT: GB 824 5386 19
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.
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/dev/attachments/20210617/ed66162c/attachment.htm>
More information about the dev
mailing list