Skip to Content.
Sympa Menu

mace-opensaml-users - Re: [OpenSAML] Unable to Decode message encoded by HTTPRedirectDeflateEncoder

Subject: OpenSAML user discussion

List archive

Re: [OpenSAML] Unable to Decode message encoded by HTTPRedirectDeflateEncoder


Chronological Thread 
  • From: John Gonzales <>
  • To:
  • Cc: Chris Card <>
  • Subject: Re: [OpenSAML] Unable to Decode message encoded by HTTPRedirectDeflateEncoder
  • Date: Sat, 05 Feb 2011 10:40:30 -0600
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; b=APhFwjcocRBQsO/ZG22hIsWuJ+lKU+4WxxFLlR8Yzwxk9gJGiECJvez56pIj9/QU+K DYWrrRZtBisTQ0JVA9Abp3cspXSROTlvn81i0bOwc7/Dqtd6Gh+SE7/q5p3OryoeiNjR r5imALEFjpKprRSC3Mga8KR+NnixzzOkJIwz0=

On 11-02-05 10:34 AM, Chris Card wrote:


> To:
> From:
> Date: Sat, 5 Feb 2011 11:25:32 -0500
> Subject: [OpenSAML] Unable to Decode message encoded by HTTPRedirectDeflateEncoder
>
> Hi there,
>
> I am sending an encoded message across the wire to a Rails application I am
> developing. When I try decode this message, I get the an error of
> "Zlib::DataError incorrect header check". I have tried many different things
> not the Rails-end of this equation, but I'm wondering if there might be
> something wrong on the OpenSAML-end via the Java OpenSAML Library.
>
> Here is my Java code that encodes the message:
>
> HttpServletResponseAdapter responseAdapter = new
> HttpServletResponseAdapter(response, false);
>
> responseAdapter.setStatusCode(HttpServletResponse.SC_MOVED_TEMPORARILY);
>
> SingleSignOnService ssoService = new
> SingleSignOnServiceBuilder().buildObject();
> ssoService.setLocation(identityProviderSSOServiceURL);
>
> AuthnRequest authnRequest = Saml2Util.createAuthnRequest();
> BasicSAMLMessageContext messageContext = new
> BasicSAMLMessageContext();
> messageContext.setOutboundMessage(authnRequest);
> messageContext.setOutboundSAMLMessage(authnRequest);
> messageContext.setOutboundMessageTransport(responseAdapter);
> messageContext.setPeerEntityEndpoint(ssoService);
>
> HTTPRedirectDeflateEncoder encoder = new
> HTTPRedirectDeflateEncoder();
> encoder.encode(messageContext);
>
> On the Rails-end, all GET parameters are automatically URL-decoded. So all I
> need to do is Base64 Decode, then INFLATE. Here is my code that does this
> latter piece:
>
> Zlib::Inflate.inflate(Base64.decode64(message)
>
> message is the URL-decoded SAMLRequest GET parameter.
>
> Fairly simple, but then again, I'm not sure if I implemented the Java-end
> correctly. In any case, when my Ruby/Rails code executes, I get the error I
> mentioned above. For good measure, here it is once again:
>
> Zlib::DataError (incorrect header check):
> mylib/codecs.rb:19:in `inflate'
>
> As the stack trace reports, the error is happening while trying to inflate the
> message. I've searched and tried many alternatives to get this message to
> decode on the Rails-end, but nothing has worked so far. My searches are
> suggesting that perhaps the message itself is corrupt, which is why I'm taking
> a look at the Java-end.
>
> I've been scratching my head for the two-hours on the Rails-end, and the past
> hour on the Java-end. Needless to say, any help would be greatly appreciated!
>
> Thanks in advance!
Do you have to do something like
Zlib::Inflate.new(-Zlib::MAX_WBITS).inflate(Base64.decode64(message)
?
(see e.g. http://www.agileweboperations.com/how-inflate-and-deflate-data-ruby-and-php)

Chris
Wow. Thank you, Chris! I wish I would have asked sooner -- I would have saved myself 3 hours!

I thought I gave the OpenSAML API and other SAML documentation (i.e., bindings, profiles, core, etc.) a good read, but I clearly missed something. So I am very curious, should/would I have been able to pick this information up from either the two resources I just mentioned?

-jg.



Archive powered by MHonArc 2.6.16.

Top of Page