Base64 encode SAML Response problems?

o haya ohaya at yahoo.com
Sun Feb 17 21:13:27 EST 2019


Hi,
I am trying to implement a Java app using OpenSAML that can integrate with a service provider/SP endpoint that is provided as part of Oracle's Access Manager (OAM) federation capability.  
What I have been able to do thus far is implement a Java app that can produce a SAML response message that includes an signed assertion and that looks like it matches some SAML response messages that I have captured from previous testing with OAM federation.  

However, when I try to send the responses from my Java app into OAM federation, I am getting a "system error" and looking at the stacktraces in the logs, it appears that OAM is encountering some kind of Base64-related error.  I am not 100% sure, but it appears  that this error is happening when OAM is attempting to get the return URL.
Right now, the processing that I do after I build the SAML response (in a string named 'samlResponse', and the return URL for my test should be 'http://sandboxdtm01.xxx.dev:38443/test.html') is:
...
        Base64.Encoder encoder = Base64.getUrlEncoder();                          // I have also tried using just Base64.getEncoder()...
        String str = encoder.encodeToString(samlResponse.getBytes());  
        String str2 = "SAMLResponse=" + str + "&RelayState=https%3A%2F%2Fsandboxdtm01.xxx.dev%3A38443%2Ftest.html";
        System.out.println("\n\n========================================\nBASE64-Encoded string:\n");
        System.out.println(str2);
        System.out.println("\n============================================\n"); 
....
        
The resulting 'str2' value looks like (following is a snippet of an example):
SAMLResponse=PD94.....cDpSZXNwb25zZT4=&RelayState=https%3A%2F%2Fsandboxdtm01.gxaws.dev%3A38443%2Ftest.html
and I send that 'str2' value as the content body in a POST to the OAM SP endpoint, which results in the 'system error'.
Is what I doing above for the Base64 encoding of the samlResponse correct for building the SAML response and the RelayState?
Also, part of the reason I am asking the above (besides the error stacktraces mentioning Base64) is that, from the logging of the "good" captures that I did with OAM previously, it looks like the SAMLResponse that is being sent in the "good" tests end with TWO equal signs ('==') whereas the Base64 strings I am seeing from my code seem to have only one equal ('=') at the end, which is making me wondering if I should be doing different for the Base64 encoding?
Thanks for your patience!!
Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/dev/attachments/20190218/5e9e480d/attachment.html>


More information about the dev mailing list