diff --git a/modules/casserver/www/cas.php b/modules/casserver/www/cas.php new file mode 100644 index 0000000000000000000000000000000000000000..180120a1c0a3a30d8f2bcd0b1198cf97917011dd --- /dev/null +++ b/modules/casserver/www/cas.php @@ -0,0 +1,13 @@ +<?php + +/* + * Frontend for login.php, validate.php and serviceValidate.php. It allows them to be called + * as cas.php/login, cas.php/validate and cas.php/serviceValidate and is meant for clients + * like phpCAS which expects one configured prefix which it appends login, validate and + * serviceValidate to. + */ + + +list($function) = preg_split('/[\/?]/', $_SERVER['PATH_INFO'], 0, PREG_SPLIT_NO_EMPTY); + +include($function.".php"); \ No newline at end of file diff --git a/modules/casserver/www/login.php b/modules/casserver/www/login.php index cfe3a714c6da7f162fe020f4f36d43f1a832fdc6..34fd04d5c893f4f021c40aa9b7352c72303fb4f6 100644 --- a/modules/casserver/www/login.php +++ b/modules/casserver/www/login.php @@ -52,7 +52,7 @@ if (!$session->isValid($auth) ) { $attributes = $session->getAttributes(); $path = $casconfig->resolvePath($casconfig->getValue('ticketcache', 'ticketcache')); -$ticket = SimpleSAML_Utilities::generateID(); +$ticket = str_replace( '_', 'ST-', SimpleSAML_Utilities::generateID() ); storeTicket($ticket, $path, $attributes); // $test = retrieveTicket($ticket, $path); diff --git a/modules/casserver/www/serviceValidate.php b/modules/casserver/www/serviceValidate.php index dde96ade3ae7277c9c50a3a1bd3835d18f6c1c6a..823f5922245fe4fc75ead5c361fbbceb417c0eab 100644 --- a/modules/casserver/www/serviceValidate.php +++ b/modules/casserver/www/serviceValidate.php @@ -91,7 +91,7 @@ function storeTicket($ticket, $path, &$value ) { function retrieveTicket($ticket, $path) { - if (!preg_match('/^_?[a-zA-Z0-9]+$/D', $ticket)) throw new Exception('Invalid characters in ticket'); + if (!preg_match('/^ST-?[a-zA-Z0-9]+$/D', $ticket)) throw new Exception('Invalid characters in ticket'); if (!is_dir($path)) throw new Exception('Directory for CAS Server ticket storage [' . $path . '] does not exists. '); diff --git a/modules/casserver/www/validate.php b/modules/casserver/www/validate.php index 27e847efea182ea2e9261e7cdd6948943b20698a..4622e0c2b58a0f3a959e9ff0354df03478c39708 100644 --- a/modules/casserver/www/validate.php +++ b/modules/casserver/www/validate.php @@ -72,7 +72,8 @@ function storeTicket($ticket, $path, &$value ) { function retrieveTicket($ticket, $path) { - if (!preg_match('/^_?[a-zA-Z0-9]+$/D', $ticket)) throw new Exception('Invalid characters in ticket'); + if (!preg_match('/^ST-?[a-zA-Z0-9]+$/D', $ticket)) throw new Exception('Invalid characters in ticket'); + if (!is_dir($path)) throw new Exception('Directory for CAS Server ticket storage [' . $path . '] does not exists. ');