I'm working on an SSO solution for a client. At this time I'm able to encode an authentication message and successfully send it to the ADFS server. The ADFS server handles my login and then returns to my site with an HTTP-POST response. In the POST there is an ADFS encoded SAML message I need to decipher. I found a few samples of code but none have worked. This one seemed to have the most promise but...
<cfscript>
// Decode the query string from Base 64
Decoder = CreateObject("Java", "sun.misc.BASE64Decoder").init();
SamlByte = Decoder.decodeBuffer(Form.SAMLResponse);
// Create Byte Array used for the inflation, the CF way
ByteClass = CreateObject("Java", "java.lang.Byte").TYPE;
ByteArray = CreateObject("Java", "java.lang.reflect.Array").NewInstance(ByteClass, 1024);
// Create Byte Streams needed for inflation
ByteIn = CreateObject("Java", "java.io.ByteArrayInputStream").init(SamlByte);
ByteOut = CreateObject("Java", "java.io.ByteArrayOutputStream").init();
// Create Objects needed for inflation
Inflater = CreateObject("Java", "java.util.zip.Inflater").init(true);
InflaterStream = CreateObject("Java", "java.util.zip.InflaterInputStream").init(ByteIn, Inflater);
// Complete the inflation
Count = InflaterStream.read(ByteArray);
while (Count != -1) {
ByteOut.write(ByteArray, 0, Count);
Count = InflaterStream.read(ByteArray);
}
// Finished with inflation
Inflater.end();
InflaterStream.close();
// Convert SAML request back to a string
SamlString = CreateObject("Java", "java.lang.String").init(ByteOut.toByteArray());
</cfscript>
When the code get to the Count = InflaterStream.read(ByteArray); statement the following error message is returned: oversubscribed dynamic bit lengths tree
My question is does anybody have a snippet of code that is used to successfully decipher an ADFS encoded SAML response?