<?php
//Suppose you have already asked user to authenticate himself through a login form
//The following is the action part of the login form
//CHANGE THEM:
$secret = "YOUR_SHARED_SECRET";
$username = "USER_NAME";
$email = "USER_EMAIL";
$site = "YOUR_SITE_NAME";
$displayName = "USERS_FULL_NAME"; //optional
$phone = "USERS_PHONE"; //optional
$organization = "ORGANIZATION"; //optional
//END OF CHANGE THEM
$redirectURL = "http://www.ihelpdesk.com/desktop/SsoServlet.hd?c=".$site."&";
$hash = sha1($secret."@@".$username."@@".$email);
$parameters = "username=$username&email=$email";
/* optional parameters */
$parameters .="&displayName=$displayName&phone=$phone&organization=$organization";
$parameters = base64_encode($parameters);
//If $usePostSubmit is true, then parameters will be submitted thru HTTP POST
$usePostSubmit = true;
if(! $usePostSubmit)
{
$redirectURL .= "parameters=$parameters&hash=$hash";
Header("Location:$redirectURL");
}
else
{
$form = '<html><head><title>SSO Redirect</title></head><body>';
$form .= '<form id="ssoRedirectForm" name="ssoRedirectForm" method="POST" action="'.$redirectURL.'">';
$form .= '<input type="hidden" name="parameters" value="'.$parameters.'">';
$form .= '<input type="hidden" name="hash" value="'.$hash.'">';
$form .= '</form><script type="text/javascript">document.ssoRedirectForm.submit();</script></body></html>';
echo $form;
}
?>