<!DOCTYPE HTML> <html> <head> <title>SignRequest-with-Ajax</title> <script> function get_signature(forward) { myAjax = new XMLHttpRequest(); myAjax.onreadystatechange = function () { if (myAjax.readyState == 4 && myAjax.status == 200) { if (forward) { document.getElementById("output").innerHTML = "Forwarding response..."; document.getElementById("SignResponse").innerHTML = myAjax.responseText; document.SignResponse.submit(); } else { document.getElementById("output").innerHTML = myAjax.responseText.replace(/</g, "<").replace(/>/g, ">").replace(/\r\n/g, "<br>"); } } }; var url = "https://s1.mycomp.com/signresponse.aspx"; //change node name as necessary var postdata = "challenge=DB-95-E8-83-66-88-8B-E9-31-64-87-D2-6A-43-6C-39-14-C7-00-85&hashalg=SHA256"; myAjax.open("POST", url, true); myAjax.withCredentials = true; myAjax.send(postdata); } </script> </head> <body> <input type="button" value="Get signature and forward response" onClick="get_signature(true)"><br> <input type="button" value="Get signature and display response" onClick="get_signature(false)"><br> <div style="width:1000px; border: 1px black solid;" id="output">.... not started ....</div> <form name="SignResponse" id="SignResponse" method="post" action="signresult.aspx"></form> </body> </html>Template for response in case of success: signresponse.aspx
<input type="hidden" name="challenge" value="%challenge%" /> <input type="hidden" name="hashalg" value="%hashalg%" /> <input type="hidden" name="signature" value="%signature%" /> <input type="hidden" name="usercert" value="%usercert%" /> <input type="hidden" name="appgwcert" value="%appgwcert%" />Template for response in case of error: signresponse_err.aspx
<input type="hidden" name="errmsg" value="%errmsg%" /> <input type="hidden" name="challenge" value="%challenge%" /> <input type="hidden" name="hashalg" value="%hashalg%" />Note: File extensions have no meaning for templates.
reinhold.leitner@applicgate.com (C) September 2024 www.applicgate.com |