opensaml encoding problems with xml to base64

Brent Putman putmanb at georgetown.edu
Wed Nov 5 01:44:11 EST 2014



On 11/4/14 11:29 PM, Jason Novotny wrote:
>
>
> ^A}^B<82><FD><?xml version="1.0" encoding="UTF-8"?><samlp:AuthnRequest 
> xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" 
> AssertionConsumerServiceIndex="0" 
> AssertionConsumerServiceURL="https://alpha.advisorservices.com/servlet/advisor/samlssologin/" 
> ForceAuthn="true" ID="_ab8203e72b5be4ce" IsPassive="true" 
> IssueInstant="2014-09-08T16:51:29.649Z" 
> ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" 
> ProviderName="https://www.advisorservices.com/" 
> Version="2.0"><saml:Issuer 
> xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">https://www.advisorservices.com/</saml:Issuer><samlp:NameIDPolicy 
> AllowCreate="true"/></samlp:AuthnRequest>
>
>
> As you can see, there are 5 bytes at the beginning that I cleared away 
> with my parseDocument1 method, but of course that's a terrible hack. I 
> just can't quite understand how those bytes get there..

On the inbound:  No mystery.  Looks like it's the HTTP Redirect
binding.  Consult the SAML 2 binding spec - it's not just
Base64-encoded, it's also DEFLATEd. 

OpenSAML has a full set of decoder and encoders which handle the details
of the bindings.  We don't have good docs on this aspect of the library,
but the unit tests should be illustrative.  Here's the one for SAML 2
Redirect binding:

http://svn.shibboleth.net/view/java-opensaml2/branches/REL_2/src/test/java/org/opensaml/saml2/binding/decoding/HTTPRedirectDeflateDecoderTest.java?revision=1534&view=markup



> and the 
> SAMLResponse that I send out apparently is not decoded into proper 
> XML. 


Same thing, our encoder impls are the easiest route.  E.g. for SAML 2
POST binding:


http://svn.shibboleth.net/view/java-opensaml2/branches/REL_2/src/test/java/org/opensaml/saml2/binding/encoding/HTTPPostEncoderTest.java?revision=1674&view=markup


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://shibboleth.net/pipermail/dev/attachments/20141105/d76b3efb/attachment.html 


More information about the dev mailing list