ComponentSpace

Forums



Adding Parameter to HTML Posted Form


Adding Parameter to HTML Posted Form

Author
Message
ACampbell
ACampbell
New Member
New Member (2 reputation)New Member (2 reputation)New Member (2 reputation)New Member (2 reputation)New Member (2 reputation)New Member (2 reputation)New Member (2 reputation)New Member (2 reputation)New Member (2 reputation)

Group: Forum Members
Posts: 1, Visits: 3
We are performing and IdP-initiated SSO connection using the SendSAMLResponseByHTTPPost to an SP of our client. Issue is that the SP is asking for a hidden parameter to be included in the HTML form that is posted. I'm not finding any documentation or examples of how to do this. Can someone tell me how this can be done (example below)?
HTTP Posted Form Currently is:

<html xmlns="http://www.w3.org/1999/xhtml">
 <body onload="document.forms.samlform.submit()">
  <noscript>
   <p>
    <strong>Note:</strong> Since your browser does not support JavaScript, you must press the Continue button once to proceed.</p>
  </noscript>
  <form id="samlform" action="
http://someurl" method="post" target="_self">
   <div>
    <input type="hidden" name="SAMLResponse" value="....."/>
    <input type="hidden" name="RelayState" value="/SomewhereElse"/>
   </div>
   <noscript>
    <div>
     <input type="submit" value="Continue"/>
    </div>
   </noscript>
  </form>
 </body>
</html>

What it needs to look like
<html xmlns="http://www.w3.org/1999/xhtml">
 <body onload="document.forms.samlform.submit()">
  <noscript>
   <p>
    <strong>Note:</strong> Since your browser does not support JavaScript, you must press the Continue button once to proceed.</p>
  </noscript>
  <form id="samlform" action="
http://someurl" method="post" target="_self">
   <div>
    <input type="hidden" name="SAMLResponse" value="....."/>
    <input type="hidden" name="RelayState" value="/SomewhereElse"/>
<input type="hidden" name="CustomParamName" value="Stuff"/>
   </div>
   <noscript>
    <div>
     <input type="submit" value="Continue"/>
    </div>
   </noscript>
  </form>
 </body>
</html>


ComponentSpace
ComponentSpace
ComponentSpace Development
ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)

Group: Administrators
Posts: 3.2K, Visits: 11K
You can update the HTML form used for the HTTP Post using the HTTPPostBinding class under the ComponentSpace.SAML2.Bindings namespace.

The HTTPPostBinding.HTMLFormTemplate static property specifies the HTML form template to use.

The default is:

@"
<html>
    <body>
        <noscript>
            <p>
                Since your browser doesn't support JavaScript, you must press the Continue button to proceed.
            </p>
        </noscript>
        <form id=""samlform"" action=""{url}"" method=""post"" target=""_self"">
            <div>
                {hiddenFormVariables}
            </div>
            <noscript>
                <div>
                    <input type=""submit"" value=""Continue""/>
                </div>
            </noscript>
        </form>
    </body>
    <script>
        function submitForm() {
            document.forms.samlform.submit();
        }

        if (document.readyState === ""loading"") {
                               document.addEventListener(""DOMContentLoaded"", submitForm);
                  } else {
                               submitForm();
        }
    </script>
</html>
";

Make sure to preserve the {url} and {hiddenFormVariables} insertion parameters.


Regards
ComponentSpace Development
GO


Similar Topics


Execution: 0.000. 2 queries. Compression Enabled.
Login
Existing Account
Email Address:


Password:


Select a Forum....












Forums, Documentation & Knowledge Base - ComponentSpace


Search