diff --git a/6/index.php b/6/index.php deleted file mode 100644 index 4cb19d02460ca1789b8e366e56058438cbfaa0d2..0000000000000000000000000000000000000000 --- a/6/index.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -if ($_SERVER['REQUEST_METHOD'] != 'GET') { - exit("Invalid request method"); -} - -// multiple server neccessities in the CMS environment -$_SERVER['HTTP_X_FORWARDED_PORT'] = 443; -// session_save_path($_SERVER['DOCUMENT_ROOT'] . '/../unl.edu/tmp'); -ini_set("session.save_handler", "memcached"); -ini_set("session.save_path", "10.172.23.62:11211, 10.172.25.145:11211"); - -include(__DIR__ . "../phpCAS/source/CAS.php"); - -if (isset($_REQUEST['id'])) { - // Set the age to 1 day to improve speed/caching. - header('Expires: ' . date('r', strtotime('now + 1 day'))); - session_cache_limiter('private_no_expire'); - session_cache_expire(24*60); - - // Start session - session_start(); - - // Clear session on id change - if (isset($_SESSION['id']) and $_SESSION['id'] != $_REQUEST['id']) { - session_unset(); - } - - // Store id into session - $_SESSION['id'] = $_REQUEST['id']; - -} - -// initialize phpCAS -phpCAS::client(CAS_VERSION_2_0, 'shib.unl.edu', 443, '/idp/profile/cas'); - -// no SSL validation for the CAS server -phpCAS::setNoCasServerValidation(); - -if (!phpCAS::isAuthenticated()) { - //Remove cache headers to prevent IE from caching an empty redirect (during gateway auth) - header_remove('Expires'); - header_remove('Cache-Control'); -} - -// check CAS authentication -$auth = phpCAS::checkAuthentication(); - -header('Content-type: application/json'); - -if ($auth) { - // Get authenticated username - $username = phpCAS::getUser(); - - print file_get_contents("https://directory.unl.edu/service.php?format=json&uid=$username"); -} else { - print "{}"; -} - diff --git a/index.php b/index.php index 542fdb9047f389f968803a5f3781753583685909..9ca6ae9b647774899bc249fce17fa236b588c446 100644 --- a/index.php +++ b/index.php @@ -46,8 +46,14 @@ if (!phpCAS::isAuthenticated()) { // check CAS authentication $auth = phpCAS::checkAuthentication(); -header('Content-type: application/javascript'); -print "WDN.idm.user = "; +if (isset($_REQUEST['v']) && $_REQUEST['v'] === '6') { + header('Content-type: application/json'); + header('Access-Control-Allow-Origin: *'); + header('Access-Control-Allow-Methods: GET'); +} else { + header('Content-type: application/javascript'); + print "WDN.idm.user = "; +} if ($auth) { // Get authenticated username