1

I am using ionic to build an app that requires SAML Authentication, does anyone have some guidance on this topic??

Currently I am able to send a username and password to the API I need to hit and get back a SAML Assertion, however I haven’t found a solution with Ionic or Angular to grab the SAML token and sign in url that the response sends back as HTML . Also once I can grab that data, I will need a way to parse the xml to collect the user data. I have tried: - grabbing each element by attribute name using angular.element(document).find("input[name='SAMLResponse']”)) - RESULT - cannot find the element - using xml2json to parse SAML token response and grab the token and url - RESULT - object returned equals null

I appreciate any guidance you can offer! Thx!

sample response:

<html>\r\n<HEAD><META HTTP-EQUIV='PRAGMA' CONTENT='NO-CACHE'>
<META HTTP-EQUIV='CACHE-CONTROL' CONTENT='NO-CACHE'><TITLE>SAML 2.0 Auto-POST form</TITLE></HEAD>\r\n   <body onLoad=\"document.forms[0].submit()\">\r\n
<NOSCRIPT>Your browser does not support JavaScript.  Please click the 'Continue' button below to proceed. <br><br></NOSCRIPT>\r\n      
<form action=\"https://foobar.url.com/sso/verify/foobar\" method=\"POST\">\r\n<input type=\"hidden\" 
    name=\"SAMLResponse\" value=\"SAML ASSERTION\">\r\n
<NOSCRIPT><INPUT TYPE=\"SUBMIT\" VALUE=\"Continue\"></NOSCRIPT>\r\n 
</form>\r\n   </body>\r\n</html>\r\n
wkwyatt
  • 21
  • 6
  • Did you find a solution to this? – Sourav Das Aug 22 '17 at 03:57
  • also looking for a solution, but it's not easy to reach. I've found useful resources on telerik site: http://www.telerik.com/forums/cordova-sso-login Please let me know if you have succeeded. – Victor Dias Sep 01 '17 at 12:13

1 Answers1

0

What I ended up doing was creating a variable from the parsed xml. That variable was a JSON object that I could loop through to find the 'SAMLResponse' and the URL that I needed to send the response to. Once you have those two, everything else is pretty basic. Just send a https request with the encrypted token as data and you are set!

wkwyatt
  • 21
  • 6