<?php // ####################################################### // Author: Martin Haase / DAASI International GmbH / TextGrid // Creation date: 2010-09-23 // Modification date: 2010-09-03 // Version: 0.1 // ####################################################### mb_internal_encoding("UTF-8"); class WebUtils { // Global variables public function __construct() { } public function printFailure($heading,$detail,$loginname,$rbachash) { printHeader("Authentication failed"); if (isset($rbachash)) { echo "<meta name=\"remote_principal\" content=\"". $rbachash->remote_user."\"/>\n"; echo "<meta name=\"rbac_session_status\" content=\"". $rbachash->scstatus."\"/>\n"; echo "<meta name=\"rbac_sessionid\" content=\"". $rbachash->newSid."\"/>\n"; } echo "<style type=\"text/css\">"; echo "#d123 {display:none;}"; echo "</style>"; echo "<script type=\"text/javascript\">\n"; echo "<!--\n"; echo "function toggle (target) {\n"; echo " var obj=document.getElementById(target);\n"; echo " obj.style.display=\"block\";\n"; echo "}\n"; echo "-->\n"; echo "</script>\n"; echo "</head>\n\n<body>\n"; echo "<h2>Authentication Failure, $heading</h2>\n"; echo "<p>The Authentication system could not authenticate you.</p>\n"; echo "<p>More <a href=\"javascript:toggle('d123')\">Details</a>.</p>\n"; echo "<div id=\"d123\">"; echo "<h2>Error Details</h2>\n"; echo "<p>". $detail ."</p>" ; echo "<h2>Authentication Details</h2>\n"; echo "<table>\n"; echo "<tr><td>Login Name</td><td>". $loginname ."</td></tr>\n"; if (isset($rbachash->rbacbase)) { echo "<tr><td>TgAuth Instance</td><td>". $rbachash->rbacbase ."</td></tr>\n"; } if (isset($rbachash->identity_provider)) { echo "<tr><td>Shibboleth Identity ProviderID</td><td>". $rbachash->identity_provider ."</td></tr>\n"; } if (isset($rbachash->$identified_user['authnmethod'] )) { echo "<tr><td>User ID Attribute Name</td><td>". $rbachash->identified_user['authnmethod'] ."</td></tr>\n"; } if (isset($rbachash->remote_user.)) { echo "<tr><td>User ID Value </td><td>".$rbachash->remote_user."</td></tr>\n"; } if (isset($rbachash->newSid.)) { echo "<tr><td>TgAuth Session ID</td><td>".$rbachash->newSid."</td></tr>\n"; } echo "</table>\n"; echo "</div>"; echo "<p>If not indicated otherwise in the <a href=\"javascript:toggle('d123')\">details</a>, it could be that some service is not responding temporarily. In this case, please <a href=\"javascript:history.back()\">go back</a> or re-open the TextGridLab and try again.</p>"; echo "<p>If the problem persists, please report this bug together with its time of occurence (" . date("Y-m-d H:i:s") . "). In the TextGridLab, choose 'Help->Report Bug'.</p>" ; echo "\n</body>\n</html>"; } public function printHeader ($title) { echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\n"; echo "<head>\n"; echo "<title>" . $title . "</title>\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n"; } }