'. $lang->getShouldHaveBeenRedirected(). '
', $cas_url); + $this->printHTMLFooter(); + phpCAS::traceExit(); + throw new CAS_GracefullTerminationException(); + } + + + /** + * This method is used to logout from CAS. + * + * @param array $params an array that contains the optional url and service + * parameters that will be passed to the CAS server + * + * @return void + */ + public function logout($params) + { + phpCAS::traceBegin(); + $cas_url = $this->getServerLogoutURL(); + $paramSeparator = '?'; + if (isset($params['url'])) { + $cas_url = $cas_url . $paramSeparator . "url=" . urlencode($params['url']); + $paramSeparator = '&'; + } + if (isset($params['service'])) { + $cas_url = $cas_url . $paramSeparator . "service=" . urlencode($params['service']); + } + header('Location: '.$cas_url); + phpCAS::trace("Prepare redirect to : ".$cas_url); + + session_unset(); + session_destroy(); + $lang = $this->getLangObj(); + $this->printHTMLHeader($lang->getLogout()); + printf(''.$lang->getShouldHaveBeenRedirected(). '
', $cas_url); + $this->printHTMLFooter(); + phpCAS::traceExit(); + throw new CAS_GracefullTerminationException(); + } + + /** + * Check of the current request is a logout request + * + * @return bool is logout request. + */ + private function _isLogoutRequest() + { + return !empty($_POST['logoutRequest']); + } + + /** + * This method handles logout requests. + * + * @param bool $check_client true to check the client bofore handling + * the request, false not to perform any access control. True by default. + * @param bool $allowed_clients an array of host names allowed to send + * logout requests. + * + * @return void + */ + public function handleLogoutRequests($check_client=true, $allowed_clients=false) + { + phpCAS::traceBegin(); + if (!$this->_isLogoutRequest()) { + phpCAS::trace("Not a logout request"); + phpCAS::traceEnd(); + return; + } + if (!$this->getChangeSessionID() && is_null($this->_signoutCallbackFunction)) { + phpCAS::trace("phpCAS can't handle logout requests if it is not allowed to change session_id."); + } + phpCAS::trace("Logout requested"); + $decoded_logout_rq = urldecode($_POST['logoutRequest']); + phpCAS::trace("SAML REQUEST: ".$decoded_logout_rq); + $allowed = false; + if ($check_client) { + if (!$allowed_clients) { + $allowed_clients = array( $this->_getServerHostname() ); + } + $client_ip = $_SERVER['REMOTE_ADDR']; + $client = gethostbyaddr($client_ip); + phpCAS::trace("Client: ".$client."/".$client_ip); + foreach ($allowed_clients as $allowed_client) { + if (($client == $allowed_client) or ($client_ip == $allowed_client)) { + phpCAS::trace("Allowed client '".$allowed_client."' matches, logout request is allowed"); + $allowed = true; + break; + } else { + phpCAS::trace("Allowed client '".$allowed_client."' does not match"); + } + } + } else { + phpCAS::trace("No access control set"); + $allowed = true; + } + // If Logout command is permitted proceed with the logout + if ($allowed) { + phpCAS::trace("Logout command allowed"); + // Rebroadcast the logout request + if ($this->_rebroadcast && !isset($_POST['rebroadcast'])) { + $this->_rebroadcast(self::LOGOUT); + } + // Extract the ticket from the SAML Request + preg_match("|Storing PGT `'.$pgt.'\' (id=`'.$pgt_iou.'\').
'; + $this->_storePGT($pgt, $pgt_iou); + $this->printHTMLFooter(); + phpCAS::traceExit("Successfull Callback"); + } else { + phpCAS::error('PGT format invalid' . $_GET['pgtId']); + phpCAS::traceExit('PGT format invalid' . $_GET['pgtId']); + } + } else { + phpCAS::error('PGTiou format invalid' . $_GET['pgtIou']); + phpCAS::traceExit('PGTiou format invalid' . $_GET['pgtIou']); + } + + // Flush the buffer to prevent from sending anything other then a 200 + // Success Status back to the CAS Server. The Exception would normally + // report as a 500 error. + flush(); + throw new CAS_GracefullTerminationException(); + } + + + /** @} */ + + // ######################################################################## + // PGT STORAGE + // ######################################################################## + /** + * @addtogroup internalPGTStorage + * @{ + */ + + /** + * an instance of a class inheriting of PGTStorage, used to deal with PGT + * storage. Created by CAS_Client::setPGTStorageFile(), used + * by CAS_Client::setPGTStorageFile() and CAS_Client::_initPGTStorage(). + * + * @hideinitializer + */ + private $_pgt_storage = null; + + /** + * This method is used to initialize the storage of PGT's. + * Halts on error. + * + * @return void + */ + private function _initPGTStorage() + { + // if no SetPGTStorageXxx() has been used, default to file + if ( !is_object($this->_pgt_storage) ) { + $this->setPGTStorageFile(); + } + + // initializes the storage + $this->_pgt_storage->init(); + } + + /** + * This method stores a PGT. Halts on error. + * + * @param string $pgt the PGT to store + * @param string $pgt_iou its corresponding Iou + * + * @return void + */ + private function _storePGT($pgt,$pgt_iou) + { + // ensure that storage is initialized + $this->_initPGTStorage(); + // writes the PGT + $this->_pgt_storage->write($pgt, $pgt_iou); + } + + /** + * This method reads a PGT from its Iou and deletes the corresponding + * storage entry. + * + * @param string $pgt_iou the PGT Iou + * + * @return mul The PGT corresponding to the Iou, false when not found. + */ + private function _loadPGT($pgt_iou) + { + // ensure that storage is initialized + $this->_initPGTStorage(); + // read the PGT + return $this->_pgt_storage->read($pgt_iou); + } + + /** + * This method can be used to set a custom PGT storage object. + * + * @param CAS_PGTStorage_AbstractStorage $storage a PGT storage object that + * inherits from the CAS_PGTStorage_AbstractStorage class + * + * @return void + */ + public function setPGTStorage($storage) + { + // check that the storage has not already been set + if ( is_object($this->_pgt_storage) ) { + phpCAS::error('PGT storage already defined'); + } + + // check to make sure a valid storage object was specified + if ( !($storage instanceof CAS_PGTStorage_AbstractStorage) ) { + phpCAS::error('Invalid PGT storage object'); + } + + // store the PGTStorage object + $this->_pgt_storage = $storage; + } + + /** + * This method is used to tell phpCAS to store the response of the + * CAS server to PGT requests in a database. + * + * @param string $dsn_or_pdo a dsn string to use for creating a PDO + * object or a PDO object + * @param string $username the username to use when connecting to the + * database + * @param string $password the password to use when connecting to the + * database + * @param string $table the table to use for storing and retrieving + * PGTs + * @param string $driver_options any driver options to use when connecting + * to the database + * + * @return void + */ + public function setPGTStorageDb($dsn_or_pdo, $username='', $password='', $table='', $driver_options=null) + { + // create the storage object + $this->setPGTStorage(new CAS_PGTStorage_Db($this, $dsn_or_pdo, $username, $password, $table, $driver_options)); + } + + /** + * This method is used to tell phpCAS to store the response of the + * CAS server to PGT requests onto the filesystem. + * + * @param string $path the path where the PGT's should be stored + * + * @return void + */ + public function setPGTStorageFile($path='') + { + // create the storage object + $this->setPGTStorage(new CAS_PGTStorage_File($this, $path)); + } + + + // ######################################################################## + // PGT VALIDATION + // ######################################################################## + /** + * This method is used to validate a PGT; halt on failure. + * + * @param string &$validate_url the URL of the request to the CAS server. + * @param string $text_response the response of the CAS server, as is + * (XML text); result of CAS_Client::validateCAS10() or CAS_Client::validateCAS20(). + * @param string $tree_response the response of the CAS server, as a DOM XML + * tree; result of CAS_Client::validateCAS10() or CAS_Client::validateCAS20(). + * + * @return bool true when successfull and issue a CAS_AuthenticationException + * and false on an error + */ + private function _validatePGT(&$validate_url,$text_response,$tree_response) + { + phpCAS::traceBegin(); + if ( $tree_response->getElementsByTagName("proxyGrantingTicket")->length == 0) { + phpCAS::trace('No estàs autentificat.
Pots tornar a intentar-ho fent click aquí.
Si el problema persisteix hauría de contactar amb l\'administrador d\'aquest llocc.
'; + } + + /** + * Get the service unavailable string + * + * @return string service unavailable + */ + public function getServiceUnavailable() + { + return 'El servei `%s\' no està disponible (%s).'; + } +} diff --git a/auth/cas/CAS/CAS/Languages/English.php b/auth/cas/CAS/CAS/Languages/English.php new file mode 100644 index 00000000000..002c1ba49e9 --- /dev/null +++ b/auth/cas/CAS/CAS/Languages/English.php @@ -0,0 +1,114 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ + +/** + * English language class + * + * @class CAS_Languages_English + * @category Authentication + * @package PhpCAS + * @author Pascal AubryYou were not authenticated.
You may submit your request again by clicking here.
If the problem persists, you may contact the administrator of this site.
'; + } + + /** + * Get the service unavailable string + * + * @return string service unavailable + */ + public function getServiceUnavailable() + { + return 'The service `%s\' is not available (%s).'; + } +} \ No newline at end of file diff --git a/auth/cas/CAS/CAS/Languages/French.php b/auth/cas/CAS/CAS/Languages/French.php new file mode 100644 index 00000000000..b99847a7f06 --- /dev/null +++ b/auth/cas/CAS/CAS/Languages/French.php @@ -0,0 +1,116 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ + +/** + * French language class + * + * @class CAS_Languages_French + * @category Authentication + * @package PhpCAS + * @author Pascal AubryVous n\'avez pas été authentifié(e).
Vous pouvez soumettre votre requete à nouveau en cliquant ici.
Si le problème persiste, vous pouvez contacter l\'administrateur de ce site.
'; + } + + /** + * Get the service unavailable string + * + * @return string service unavailable + */ + public function getServiceUnavailable() + { + return 'Le service `%s\' est indisponible (%s)'; + } +} + +?> \ No newline at end of file diff --git a/auth/cas/CAS/CAS/Languages/German.php b/auth/cas/CAS/CAS/Languages/German.php new file mode 100644 index 00000000000..84199d14f2d --- /dev/null +++ b/auth/cas/CAS/CAS/Languages/German.php @@ -0,0 +1,116 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ + +/** + * German language class + * + * @class CAS_Languages_German + * @category Authentication + * @package PhpCAS + * @author Henrik GenssenSie wurden nicht angemeldet.
Um es erneut zu versuchen klicken Sie hier.
Wenn das Problem bestehen bleibt, kontkatieren Sie den Administrator dieser Seite.
'; + } + + /** + * Get the service unavailable string + * + * @return string service unavailable + */ + public function getServiceUnavailable() + { + return 'Der Dienst `%s\' ist nicht verfügbar (%s).'; + } +} + +?> \ No newline at end of file diff --git a/auth/cas/CAS/CAS/Languages/Greek.php b/auth/cas/CAS/CAS/Languages/Greek.php new file mode 100644 index 00000000000..eb0f5efefc2 --- /dev/null +++ b/auth/cas/CAS/CAS/Languages/Greek.php @@ -0,0 +1,115 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ + +/** + * Greek language class + * + * @class CAS_Languages_Greek + * @category Authentication + * @package PhpCAS + * @author Vangelis HaniotakisÄåí ôáõôïðïéçèÞêáôå.
Ìðïñåßôå íá îáíáðñïóðáèÞóåôå, êÜíïíôáò êëßê åäþ.
Åáí ôï ðñüâëçìá åðéìåßíåé, åëÜôå óå åðáöÞ ìå ôïí äéá÷åéñéóôÞ.
'; + } + + /** + * Get the service unavailable string + * + * @return string service unavailable + */ + public function getServiceUnavailable() + { + return 'Ç õðçñåóßá `%s\' äåí åßíáé äéáèÝóéìç (%s).'; + } +} +?> \ No newline at end of file diff --git a/auth/cas/CAS/CAS/Languages/Japanese.php b/auth/cas/CAS/CAS/Languages/Japanese.php new file mode 100644 index 00000000000..e9cd121ee72 --- /dev/null +++ b/auth/cas/CAS/CAS/Languages/Japanese.php @@ -0,0 +1,113 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ + +/** + * Japanese language class. Now Encoding is EUC-JP and LF + * + * @class CAS_Languages_Japanese + * @category Authentication + * @package PhpCAS + * @author fnorifǧ�ڤǤ��ޤ���Ǥ���.
�⤦���٥ꥯ�����Ȥ��������������������å�.
���꤬��褷�ʤ����� ���Υ����Ȥδ�������䤤��碌�Ƥ�������.
'; + } + + /** + * Get the service unavailable string + * + * @return string service unavailable + */ + public function getServiceUnavailable() + { + return '�����ӥ� `%s\' �����ѤǤ��ޤ��� (%s).'; + } +} +?> \ No newline at end of file diff --git a/auth/cas/CAS/CAS/Languages/LanguageInterface.php b/auth/cas/CAS/CAS/Languages/LanguageInterface.php new file mode 100644 index 00000000000..5de93aa7b20 --- /dev/null +++ b/auth/cas/CAS/CAS/Languages/LanguageInterface.php @@ -0,0 +1,96 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ + +/** + * Language Interface class for all internationalization files + * + * @class CAS_Languages_LanguageInterface + * @category Authentication + * @package PhpCAS + * @author Joachim FritschiNo estás autentificado.
Puedes volver a intentarlo haciendo click aquí.
Si el problema persiste debería contactar con el administrador de este sitio.
'; + } + + /** + * Get the service unavailable string + * + * @return string service unavailable + */ + public function getServiceUnavailable() + { + return 'El servicio `%s\' no está disponible (%s).'; + } +} +?> diff --git a/auth/cas/CAS/CAS/OutOfSequenceException.php b/auth/cas/CAS/CAS/OutOfSequenceException.php new file mode 100644 index 00000000000..d101811b60d --- /dev/null +++ b/auth/cas/CAS/CAS/OutOfSequenceException.php @@ -0,0 +1,49 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ + +/** + * This class defines Exceptions that should be thrown when the sequence of + * operations is invalid. Examples are: + * - Requesting the response before executing a request. + * - Changing the URL of a request after executing the request. + * + * @class CAS_OutOfSequenceException + * @category Authentication + * @package PhpCAS + * @author Adam Franco'.$this->getString(CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED).'
',$cas_url); - $this->printHTMLFooter(); - - phpCAS::traceExit(); - exit(); - } - - - /** - * This method is used to logout from CAS. - * @params $params an array that contains the optional url and service parameters that will be passed to the CAS server - * @public - */ - function logout($params) { - phpCAS::traceBegin(); - $cas_url = $this->getServerLogoutURL(); - $paramSeparator = '?'; - if (isset($params['url'])) { - $cas_url = $cas_url . $paramSeparator . "url=" . urlencode($params['url']); - $paramSeparator = '&'; - } - if (isset($params['service'])) { - $cas_url = $cas_url . $paramSeparator . "service=" . urlencode($params['service']); - } - header('Location: '.$cas_url); - phpCAS::log( "Prepare redirect to : ".$cas_url ); - - session_unset(); - session_destroy(); - - $this->printHTMLHeader($this->getString(CAS_STR_LOGOUT)); - printf(''.$this->getString(CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED).'
',$cas_url); - $this->printHTMLFooter(); - - phpCAS::traceExit(); - exit(); - } - - /** - * @return true if the current request is a logout request. - * @private - */ - function isLogoutRequest() { - return !empty($_POST['logoutRequest']); - } - - /** - * @return true if a logout request is allowed. - * @private - */ - function isLogoutRequestAllowed() { - } - - /** - * This method handles logout requests. - * @param $check_client true to check the client bofore handling the request, - * false not to perform any access control. True by default. - * @param $allowed_clients an array of host names allowed to send logout requests. - * By default, only the CAs server (declared in the constructor) will be allowed. - * @public - */ - function handleLogoutRequests($check_client=true, $allowed_clients=false) { - phpCAS::traceBegin(); - if (!$this->isLogoutRequest()) { - phpCAS::log("Not a logout request"); - phpCAS::traceEnd(); - return; - } - if(!$this->_start_session){ - phpCAS::log("phpCAS can't handle logout requests if it does not manage the session."); - } - phpCAS::log("Logout requested"); - phpCAS::log("SAML REQUEST: ".$_POST['logoutRequest']); - if ($check_client) { - if (!$allowed_clients) { - $allowed_clients = array( $this->getServerHostname() ); - } - $client_ip = $_SERVER['REMOTE_ADDR']; - $client = gethostbyaddr($client_ip); - phpCAS::log("Client: ".$client."/".$client_ip); - $allowed = false; - foreach ($allowed_clients as $allowed_client) { - if (($client == $allowed_client) or ($client_ip == $allowed_client)) { - phpCAS::log("Allowed client '".$allowed_client."' matches, logout request is allowed"); - $allowed = true; - break; - } else { - phpCAS::log("Allowed client '".$allowed_client."' does not match"); - } - } - if (!$allowed) { - phpCAS::error("Unauthorized logout request from client '".$client."'"); - printf("Unauthorized!"); - phpCAS::traceExit(); - exit(); - } - } else { - phpCAS::log("No access control set"); - } - // Extract the ticket from the SAML Request - preg_match("|Storing PGT `'.$pgt.'\' (id=`'.$pgt_iou.'\').
'; - $this->storePGT($pgt,$pgt_iou); - $this->printHTMLFooter(); - }else{ - phpCAS::error('PGT format invalid' . $_GET['pgtId']); - } - }else{ - phpCAS::error('PGTiou format invalid' . $_GET['pgtIou']); - } - phpCAS::traceExit(); - exit(); - } - - /** @} */ - - // ######################################################################## - // PGT STORAGE - // ######################################################################## - /** - * @addtogroup internalPGTStorage - * @{ - */ - - /** - * an instance of a class inheriting of PGTStorage, used to deal with PGT - * storage. Created by CASClient::setPGTStorageFile() or CASClient::setPGTStorageDB(), used - * by CASClient::setPGTStorageFile(), CASClient::setPGTStorageDB() and CASClient::initPGTStorage(). - * - * @hideinitializer - * @private - */ - var $_pgt_storage = null; - - /** - * This method is used to initialize the storage of PGT's. - * Halts on error. - * - * @private - */ - function initPGTStorage() - { - // if no SetPGTStorageXxx() has been used, default to file - if ( !is_object($this->_pgt_storage) ) { - $this->setPGTStorageFile(); - } - - // initializes the storage - $this->_pgt_storage->init(); - } - - /** - * This method stores a PGT. Halts on error. - * - * @param $pgt the PGT to store - * @param $pgt_iou its corresponding Iou - * - * @private - */ - function storePGT($pgt,$pgt_iou) - { - // ensure that storage is initialized - $this->initPGTStorage(); - // writes the PGT - $this->_pgt_storage->write($pgt,$pgt_iou); - } - - /** - * This method reads a PGT from its Iou and deletes the corresponding storage entry. - * - * @param $pgt_iou the PGT Iou - * - * @return The PGT corresponding to the Iou, FALSE when not found. - * - * @private - */ - function loadPGT($pgt_iou) - { - // ensure that storage is initialized - $this->initPGTStorage(); - // read the PGT - return $this->_pgt_storage->read($pgt_iou); - } - - /** - * This method is used to tell phpCAS to store the response of the - * CAS server to PGT requests onto the filesystem. - * - * @param $format the format used to store the PGT's (`plain' and `xml' allowed) - * @param $path the path where the PGT's should be stored - * - * @public - */ - function setPGTStorageFile($format='', - $path='') - { - // check that the storage has not already been set - if ( is_object($this->_pgt_storage) ) { - phpCAS::error('PGT storage already defined'); - } - - // create the storage object - $this->_pgt_storage = new PGTStorageFile($this,$format,$path); - } - - // ######################################################################## - // PGT VALIDATION - // ######################################################################## - /** - * This method is used to validate a PGT; halt on failure. - * - * @param $validate_url the URL of the request to the CAS server. - * @param $text_response the response of the CAS server, as is (XML text); result - * of CASClient::validateST() or CASClient::validatePT(). - * @param $tree_response the response of the CAS server, as a DOM XML tree; result - * of CASClient::validateST() or CASClient::validatePT(). - * - * @return bool TRUE when successfull, halt otherwise by calling CASClient::authError(). - * - * @private - */ - function validatePGT(&$validate_url,$text_response,$tree_response) - { - // here cannot use phpCAS::traceBegin(); alongside domxml-php4-to-php5.php - phpCAS::log('start validatePGT()'); - if ( sizeof($arr = $tree_response->get_elements_by_tagname("proxyGrantingTicket")) == 0) { - phpCAS::trace('No estàs autentificat.
Pots tornar a intentar-ho fent click aquí.
Si el problema persisteix hauría de contactar amb l\'administrador d\'aquest llocc.
', - CAS_STR_SERVICE_UNAVAILABLE - => 'El servei `%s\' no està disponible (%s).' -); - -?> diff --git a/auth/cas/CAS/CAS/languages/english.php b/auth/cas/CAS/CAS/languages/english.php deleted file mode 100644 index c1434503142..00000000000 --- a/auth/cas/CAS/CAS/languages/english.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @sa @link internalLang Internationalization @endlink - * @ingroup internalLang - */ - -$this->_strings = array( - CAS_STR_USING_SERVER - => 'using server', - CAS_STR_AUTHENTICATION_WANTED - => 'CAS Authentication wanted!', - CAS_STR_LOGOUT - => 'CAS logout wanted!', - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED - => 'You should already have been redirected to the CAS server. Click here to continue.', - CAS_STR_AUTHENTICATION_FAILED - => 'CAS Authentication failed!', - CAS_STR_YOU_WERE_NOT_AUTHENTICATED - => 'You were not authenticated.
You may submit your request again by clicking here.
If the problem persists, you may contact the administrator of this site.
', - CAS_STR_SERVICE_UNAVAILABLE - => 'The service `%s\' is not available (%s).' -); - -?> \ No newline at end of file diff --git a/auth/cas/CAS/CAS/languages/french.php b/auth/cas/CAS/CAS/languages/french.php deleted file mode 100644 index b077ec02e94..00000000000 --- a/auth/cas/CAS/CAS/languages/french.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @sa @link internalLang Internationalization @endlink - * @ingroup internalLang - */ - -$this->_strings = array( - CAS_STR_USING_SERVER - => 'utilisant le serveur', - CAS_STR_AUTHENTICATION_WANTED - => 'Authentication CAS n�cessaire !', - CAS_STR_LOGOUT - => 'D�connexion demand�e !', - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED - => 'Vous auriez du etre redirig�(e) vers le serveur CAS. Cliquez ici pour continuer.', - CAS_STR_AUTHENTICATION_FAILED - => 'Authentification CAS infructueuse !', - CAS_STR_YOU_WERE_NOT_AUTHENTICATED - => 'Vous n\'avez pas �t� authentifi�(e).
Vous pouvez soumettre votre requete � nouveau en cliquant ici.
Si le probl�me persiste, vous pouvez contacter l\'administrateur de ce site.
', - CAS_STR_SERVICE_UNAVAILABLE - => 'Le service `%s\' est indisponible (%s)' - -); - -?> \ No newline at end of file diff --git a/auth/cas/CAS/CAS/languages/german.php b/auth/cas/CAS/CAS/languages/german.php deleted file mode 100644 index 29daeb35dde..00000000000 --- a/auth/cas/CAS/CAS/languages/german.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @sa @link internalLang Internationalization @endlink - * @ingroup internalLang - */ - -$this->_strings = array( - CAS_STR_USING_SERVER - => 'via Server', - CAS_STR_AUTHENTICATION_WANTED - => 'CAS Authentifizierung erforderlich!', - CAS_STR_LOGOUT - => 'CAS Abmeldung!', - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED - => 'eigentlich häten Sie zum CAS Server weitergeleitet werden sollen. Drücken Sie hier um fortzufahren.', - CAS_STR_AUTHENTICATION_FAILED - => 'CAS Anmeldung fehlgeschlagen!', - CAS_STR_YOU_WERE_NOT_AUTHENTICATED - => 'Sie wurden nicht angemeldet.
Um es erneut zu versuchen klicken Sie hier.
Wenn das Problem bestehen bleibt, kontkatieren Sie den Administrator dieser Seite.
', - CAS_STR_SERVICE_UNAVAILABLE - => 'Der Dienst `%s\' ist nicht verfügbar (%s).' -); - -?> \ No newline at end of file diff --git a/auth/cas/CAS/CAS/languages/greek.php b/auth/cas/CAS/CAS/languages/greek.php deleted file mode 100644 index fdff77e4e55..00000000000 --- a/auth/cas/CAS/CAS/languages/greek.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @sa @link internalLang Internationalization @endlink - * @ingroup internalLang - */ - -$this->_strings = array( - CAS_STR_USING_SERVER - => '��������������� � ������������', - CAS_STR_AUTHENTICATION_WANTED - => '���������� � ����������� CAS!', - CAS_STR_LOGOUT - => '���������� � ���������� ��� CAS!', - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED - => '�� ������ �� ������ �������������� ���� ����������� CAS. ����� ���� ��� ��� �� ����������.', - CAS_STR_AUTHENTICATION_FAILED - => '� ����������� CAS �������!', - CAS_STR_YOU_WERE_NOT_AUTHENTICATED - => '��� ���������������.
�������� �� ����������������, �������� ���� ���.
��� �� �������� ���������, ����� �� ����� �� ��� �����������.
', - CAS_STR_SERVICE_UNAVAILABLE - => '� �������� `%s\' ��� ����� ��������� (%s).' -); - -?> \ No newline at end of file diff --git a/auth/cas/CAS/CAS/languages/japanese.php b/auth/cas/CAS/CAS/languages/japanese.php deleted file mode 100644 index 76ebe77bcf5..00000000000 --- a/auth/cas/CAS/CAS/languages/japanese.php +++ /dev/null @@ -1,27 +0,0 @@ -_strings = array( - CAS_STR_USING_SERVER - => 'using server', - CAS_STR_AUTHENTICATION_WANTED - => 'CAS�ˤ��ǧ�ڤ�Ԥ��ޤ�', - CAS_STR_LOGOUT - => 'CAS����?�����Ȥ��ޤ�!', - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED - => 'CAS�����Ф˹Ԥ�ɬ�פ�����ޤ�����ưŪ��ž������ʤ����� ������ ��å�����³�Ԥ��ޤ���', - CAS_STR_AUTHENTICATION_FAILED - => 'CAS�ˤ��ǧ�ڤ˼��Ԥ��ޤ���', - CAS_STR_YOU_WERE_NOT_AUTHENTICATED - => 'ǧ�ڤǤ��ޤ���Ǥ���.
�⤦���٥ꥯ�����Ȥ��������������������å�.
���꤬��褷�ʤ����� ���Υ����Ȥδ�������䤤��碌�Ƥ�������.
', - CAS_STR_SERVICE_UNAVAILABLE - => '�����ӥ� `%s\' �����ѤǤ��ޤ��� (%s).' -); - -?> \ No newline at end of file diff --git a/auth/cas/CAS/CAS/languages/languages.php b/auth/cas/CAS/CAS/languages/languages.php deleted file mode 100644 index 2c6f8bb3b30..00000000000 --- a/auth/cas/CAS/CAS/languages/languages.php +++ /dev/null @@ -1,24 +0,0 @@ - - * @sa @link internalLang Internationalization @endlink - * @ingroup internalLang - */ - -//@{ -/** - * a phpCAS string index - */ -define("CAS_STR_USING_SERVER", 1); -define("CAS_STR_AUTHENTICATION_WANTED", 2); -define("CAS_STR_LOGOUT", 3); -define("CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED", 4); -define("CAS_STR_AUTHENTICATION_FAILED", 5); -define("CAS_STR_YOU_WERE_NOT_AUTHENTICATED", 6); -define("CAS_STR_SERVICE_UNAVAILABLE", 7); -//@} - -?> \ No newline at end of file diff --git a/auth/cas/CAS/CAS/languages/spanish.php b/auth/cas/CAS/CAS/languages/spanish.php deleted file mode 100644 index 3a8ffc25358..00000000000 --- a/auth/cas/CAS/CAS/languages/spanish.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @sa @link internalLang Internationalization @endlink - * @ingroup internalLang - */ - -$this->_strings = array( - CAS_STR_USING_SERVER - => 'usando servidor', - CAS_STR_AUTHENTICATION_WANTED - => '¡Autentificación CAS necesaria!', - CAS_STR_LOGOUT - => '¡Salida CAS necesaria!', - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED - => 'Ya debería haber sido redireccionado al servidor CAS. Haga click aquí para continuar.', - CAS_STR_AUTHENTICATION_FAILED - => '¡Autentificación CAS fallida!', - CAS_STR_YOU_WERE_NOT_AUTHENTICATED - => 'No estás autentificado.
Puedes volver a intentarlo haciendo click aquí.
Si el problema persiste debería contactar con el administrador de este sitio.
', - CAS_STR_SERVICE_UNAVAILABLE - => 'El servicio `%s\' no está disponible (%s).' -); - -?> diff --git a/auth/cas/CAS/moodle_readme.txt b/auth/cas/CAS/moodle_readme.txt new file mode 100644 index 00000000000..f81b870a590 --- /dev/null +++ b/auth/cas/CAS/moodle_readme.txt @@ -0,0 +1,5 @@ +Description of phpCAS 1.3.2 library import + +* downloaded from http://downloads.jasig.org/cas-clients/php/current/ + +iarenaza diff --git a/auth/cas/auth.php b/auth/cas/auth.php index e748bbf007c..63f005b9264 100644 --- a/auth/cas/auth.php +++ b/auth/cas/auth.php @@ -181,15 +181,17 @@ class auth_plugin_cas extends auth_plugin_ldap { * */ function connectCAS() { - global $CFG, $PHPCAS_CLIENT; + global $CFG; + static $connected = false; - if (!is_object($PHPCAS_CLIENT)) { + if (!$connected) { // Make sure phpCAS doesn't try to start a new PHP session when connecting to the CAS server. if ($this->config->proxycas) { phpCAS::proxy($this->config->casversion, $this->config->hostname, (int) $this->config->port, $this->config->baseuri, false); } else { phpCAS::client($this->config->casversion, $this->config->hostname, (int) $this->config->port, $this->config->baseuri, false); } + $connected = true; } // If Moodle is configured to use a proxy, phpCAS needs some curl options set. @@ -213,9 +215,9 @@ class auth_plugin_cas extends auth_plugin_ldap { } } - if($this->config->certificate_check && $this->config->certificate_path){ + if ($this->config->certificate_check && $this->config->certificate_path){ phpCAS::setCasServerCACert($this->config->certificate_path); - }else{ + } else { // Don't try to validate the server SSL credentials phpCAS::setNoCasServerValidation(); } @@ -242,7 +244,7 @@ class auth_plugin_cas extends auth_plugin_ldap { define ('LDAP_DEREF_NEVER', 0); } if (!defined('LDAP_DEREF_ALWAYS')) { - define ('LDAP_DEREF_ALWAYS', 3); + define ('LDAP_DEREF_ALWAYS', 3); } } @@ -497,6 +499,7 @@ class auth_plugin_cas extends auth_plugin_ldap { */ function logoutpage_hook() { global $USER, $redirect; + // Only do this if the user is actually logged in via CAS if ($USER->auth === $this->authtype) { // Check if there is an alternative logout return url defined diff --git a/auth/cas/db/upgrade.php b/auth/cas/db/upgrade.php index 75e5b589890..b82fcc2f347 100644 --- a/auth/cas/db/upgrade.php +++ b/auth/cas/db/upgrade.php @@ -39,5 +39,15 @@ function xmldb_auth_cas_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2013052100, 'auth', 'cas'); } + if ($oldversion < 2013091700) { + // The value of the phpCAS language constants has changed from + // 'langname' to 'CAS_Languages_Langname'. + if ($cas_language = get_config('auth/cas', 'language')) { + set_config('language', 'CAS_Languages_'.ucfirst($cas_language), 'auth/cas'); + } + + upgrade_plugin_savepoint(true, 2013091700, 'auth', 'cas'); + } + return true; } diff --git a/auth/cas/languages.php b/auth/cas/languages.php index d2fe22b5d9e..d1de0a72cd4 100644 --- a/auth/cas/languages.php +++ b/auth/cas/languages.php @@ -1,15 +1,16 @@ $value) { - if (substr($key, 0, strlen($caslangprefix)) == $caslangprefix) { - $CASLANGUAGES[$value] = $value; + if (preg_match("/^$caslangconstprefix/", $key)) { + $CASLANGUAGES[$value] = substr($value, $caslangprefixlen); } } if (empty($CASLANGUAGES)) { - $CASLANGUAGES = array ('english' => 'english', - 'french' => 'french'); + $CASLANGUAGES = array (PHPCAS_LANG_ENGLISH => 'English', + PHPCAS_LANG_FRENCH => 'French'); } diff --git a/auth/cas/thirdpartylibs.xml b/auth/cas/thirdpartylibs.xml index 0465b0db859..36aabce2868 100644 --- a/auth/cas/thirdpartylibs.xml +++ b/auth/cas/thirdpartylibs.xml @@ -4,7 +4,7 @@