Added support for CAS authentication
git-svn-id: https://rosehill.googlecode.com/svn/trunk@67 100bd78a-fc82-11de-b5bc-ffd2847a4b57
This commit is contained in:
parent
54056d5722
commit
5d50a8125d
|
@ -9,7 +9,7 @@
|
||||||
if (isset($_REQUEST['return_url'])) {
|
if (isset($_REQUEST['return_url'])) {
|
||||||
$_SESSION['return_url'] = $_REQUEST['return_url'];
|
$_SESSION['return_url'] = $_REQUEST['return_url'];
|
||||||
}
|
}
|
||||||
require_once '/var/www/libraries/SimpleCAS/SimpleCAS/Autoload.php';
|
require_once CAS.'/SimpleCAS/Autoload.php';
|
||||||
|
|
||||||
$options = array('hostname'=>CAS_SERVER,'uri'=>CAS_URI);
|
$options = array('hostname'=>CAS_SERVER,'uri'=>CAS_URI);
|
||||||
$protocol = new SimpleCAS_Protocol_Version2($options);
|
$protocol = new SimpleCAS_Protocol_Version2($options);
|
||||||
|
@ -17,6 +17,7 @@ $client = SimpleCAS::client($protocol);
|
||||||
$client->forceAuthentication();
|
$client->forceAuthentication();
|
||||||
|
|
||||||
if ($client->isAuthenticated()) {
|
if ($client->isAuthenticated()) {
|
||||||
|
try {
|
||||||
$user = new User($client->getUsername());
|
$user = new User($client->getUsername());
|
||||||
$user->startNewSession();
|
$user->startNewSession();
|
||||||
setcookie(CAS_COOKIE,'true',0,'/',CAS_DOMAIN);
|
setcookie(CAS_COOKIE,'true',0,'/',CAS_DOMAIN);
|
||||||
|
@ -28,6 +29,10 @@ if ($client->isAuthenticated()) {
|
||||||
header('Location: '.BASE_URL);
|
header('Location: '.BASE_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
catch (Exception $e) {
|
||||||
echo "Could not log in";
|
$_SESSION['errorMessages'][] = $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
header('Location: '.BASE_URL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue