SAMLResponse parsing error?

classic Classic list List threaded Threaded
2 messages Options
AJ
Reply | Threaded
Open this post in threaded view
|

SAMLResponse parsing error?

AJ
Hi,

I just want to start off by saying that I am by no means a security expert and this is in fact my first time working with SAML. I undertstand (I think) many of the concepts, but there are still plenty of fuzzy areas for me -- a lot of just "accepting" that it works for now.

Here is what I have. I was given a message (sample SAMLResponse & RelayState) from my IdP. I used a tool that I found online (https://rnd.feide.no/simplesaml/module.php/saml2debug/debug.php) to decode the message to review the structure. I then plugged it into a url and passed the response to my servlet. My servlet run() contains the following code: (omitted try-catch for readability)

--[ code start ]----

MessageContext messageContext = new BasicSAMLMessageContext();
messageContext.setInboundMessageTransport(new HttpServletRequestAdapter(request));
HTTPPostDecoder samlMessageDecoder = new HTTPPostDecoder();
samlMessageDecoder.decode(messageContext);
Response samlResponse = (Response)messageContext.getInboundMessage();

--[code end ]----

I put a trace on the Binding, and at run time I see this show up in the console:

[ANDREW-MESSAGE] Binding URI:urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST

.. so I assume that this is working ok. Here is the strange part. If I use the HTTPPostDecoder, then I get an exception stating that it only works with messages of type This message deocoder only supports the HTTP POST. If I switch the decoder to HTTPRedirectDeflateDecoder, then I do manage to decode the message, but I get a different error:

14:46:38.822 [http-8080-1] DEBUG o.o.s.b.d.HTTPRedirectDeflateDecoder - Decoded RelayState: id-rrcf-3cZev-PRqoA-5xc1iYmxX
14:46:38.822 [http-8080-1] DEBUG o.o.s.b.d.HTTPRedirectDeflateDecoder - Base64 decoding and inflating SAML message
14:46:38.832 [http-8080-1] DEBUG o.o.w.m.decoder.BaseMessageDecoder - Parsing message stream into DOM document
14:46:38.842 [http-8080-1] ERROR o.o.w.m.decoder.BaseMessageDecoder - Encountered error parsing message into its DOM representation
org.opensaml.xml.parse.XMLParserException: Unable to read XML from input stream

To be honest, I'm not sure what the problem is, and my efforts to find someone with the same problem have turned up nothing.

Can anyone help?

Environment
------------
Tomcat 6
Java 6
OpenSAML v2.0
IdP (on the other end) is Oracle OIM
AJ
Reply | Threaded
Open this post in threaded view
|

Re: SAMLResponse parsing error?

AJ
I figured it out. One was not do obvious, though could have caught had I RTFM properly and the other is just plain old boner move on my part.

1. I hadn't endorsed the Xerces and Xalan jars
2. DefaultBootstrap.bootstrap() was missing from my code (duh).