From 4045a42445f7db6e463977f37021548f73cb01de Mon Sep 17 00:00:00 2001 From: cescobedo Date: Mon, 17 Jan 2022 12:32:43 +0100 Subject: [PATCH] MDL-71713 auth_cas: Upgrade phpCAS to 1.4.0 --- auth/cas/CAS/moodle_readme.txt | 3 - auth/cas/CAS/vendor/apereo/phpcas/CAS.php | 32 + .../CAS/{ => vendor/apereo/phpcas}/LICENSE | 0 .../cas/CAS/{ => vendor/apereo/phpcas}/NOTICE | 0 .../CAS/{ => vendor/apereo/phpcas}/README.md | 11 +- .../CAS/vendor/apereo/phpcas/composer.json | 51 + .../CAS/vendor/apereo/phpcas/phpunit.xml.dist | 21 + .../{ => vendor/apereo/phpcas/source}/CAS.php | 102 +- .../source}/CAS/AuthenticationException.php | 0 .../apereo/phpcas/source}/CAS/Autoload.php | 27 +- .../apereo/phpcas/source}/CAS/Client.php | 1001 +++++++++++------ .../apereo/phpcas/source}/CAS/CookieJar.php | 1 + .../apereo/phpcas/source}/CAS/Exception.php | 0 .../CAS/GracefullTerminationException.php | 0 .../source}/CAS/InvalidArgumentException.php | 0 .../phpcas/source}/CAS/Languages/Catalan.php | 0 .../CAS/Languages/ChineseSimplified.php | 0 .../phpcas/source}/CAS/Languages/English.php | 0 .../phpcas/source}/CAS/Languages/French.php | 0 .../phpcas/source/CAS/Languages/Galego.php | 117 ++ .../phpcas/source}/CAS/Languages/German.php | 0 .../phpcas/source}/CAS/Languages/Greek.php | 0 .../phpcas/source}/CAS/Languages/Japanese.php | 0 .../CAS/Languages/LanguageInterface.php | 0 .../source/CAS/Languages/Portuguese.php | 114 ++ .../phpcas/source}/CAS/Languages/Spanish.php | 0 ...uenceBeforeAuthenticationCallException.php | 0 .../OutOfSequenceBeforeClientException.php | 0 .../CAS/OutOfSequenceBeforeProxyException.php | 0 .../source}/CAS/OutOfSequenceException.php | 0 .../CAS/PGTStorage/AbstractStorage.php | 0 .../phpcas/source}/CAS/PGTStorage/Db.php | 0 .../phpcas/source}/CAS/PGTStorage/File.php | 0 .../phpcas/source}/CAS/ProxiedService.php | 0 .../source}/CAS/ProxiedService/Abstract.php | 0 .../source}/CAS/ProxiedService/Exception.php | 0 .../source}/CAS/ProxiedService/Http.php | 0 .../CAS/ProxiedService/Http/Abstract.php | 0 .../source}/CAS/ProxiedService/Http/Get.php | 0 .../source}/CAS/ProxiedService/Http/Post.php | 0 .../source}/CAS/ProxiedService/Imap.php | 0 .../source}/CAS/ProxiedService/Testable.php | 0 .../apereo/phpcas/source}/CAS/ProxyChain.php | 0 .../source}/CAS/ProxyChain/AllowedList.php | 0 .../phpcas/source}/CAS/ProxyChain/Any.php | 0 .../source}/CAS/ProxyChain/Interface.php | 0 .../phpcas/source}/CAS/ProxyChain/Trusted.php | 0 .../source}/CAS/ProxyTicketException.php | 0 .../source}/CAS/Request/AbstractRequest.php | 0 .../source}/CAS/Request/CurlMultiRequest.php | 0 .../source}/CAS/Request/CurlRequest.php | 4 +- .../phpcas/source}/CAS/Request/Exception.php | 0 .../CAS/Request/MultiRequestInterface.php | 0 .../source}/CAS/Request/RequestInterface.php | 0 .../phpcas/source/CAS/Session/PhpSession.php | 45 + .../source}/CAS/TypeMismatchException.php | 0 auth/cas/CAS/vendor/autoload.php | 7 + auth/cas/CAS/vendor/composer/ClassLoader.php | 572 ++++++++++ .../CAS/vendor/composer/InstalledVersions.php | 350 ++++++ auth/cas/CAS/vendor/composer/LICENSE | 21 + .../CAS/vendor/composer/autoload_classmap.php | 58 + .../vendor/composer/autoload_namespaces.php | 9 + .../cas/CAS/vendor/composer/autoload_psr4.php | 10 + .../cas/CAS/vendor/composer/autoload_real.php | 57 + .../CAS/vendor/composer/autoload_static.php | 84 ++ auth/cas/CAS/vendor/composer/installed.json | 128 +++ auth/cas/CAS/vendor/composer/installed.php | 41 + .../CAS/vendor/composer/platform_check.php | 26 + auth/cas/CAS/vendor/psr/log/LICENSE | 19 + .../vendor/psr/log/Psr/Log/AbstractLogger.php | 128 +++ .../log/Psr/Log/InvalidArgumentException.php | 7 + .../CAS/vendor/psr/log/Psr/Log/LogLevel.php | 18 + .../psr/log/Psr/Log/LoggerAwareInterface.php | 18 + .../psr/log/Psr/Log/LoggerAwareTrait.php | 26 + .../psr/log/Psr/Log/LoggerInterface.php | 125 ++ .../vendor/psr/log/Psr/Log/LoggerTrait.php | 142 +++ .../CAS/vendor/psr/log/Psr/Log/NullLogger.php | 30 + .../vendor/psr/log/Psr/Log/Test/DummyTest.php | 18 + .../log/Psr/Log/Test/LoggerInterfaceTest.php | 138 +++ .../psr/log/Psr/Log/Test/TestLogger.php | 147 +++ auth/cas/CAS/vendor/psr/log/README.md | 58 + auth/cas/CAS/vendor/psr/log/composer.json | 26 + 82 files changed, 3409 insertions(+), 383 deletions(-) delete mode 100644 auth/cas/CAS/moodle_readme.txt create mode 100644 auth/cas/CAS/vendor/apereo/phpcas/CAS.php rename auth/cas/CAS/{ => vendor/apereo/phpcas}/LICENSE (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas}/NOTICE (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas}/README.md (85%) create mode 100644 auth/cas/CAS/vendor/apereo/phpcas/composer.json create mode 100644 auth/cas/CAS/vendor/apereo/phpcas/phpunit.xml.dist rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS.php (94%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/AuthenticationException.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Autoload.php (77%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Client.php (82%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/CookieJar.php (99%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Exception.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/GracefullTerminationException.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/InvalidArgumentException.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Languages/Catalan.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Languages/ChineseSimplified.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Languages/English.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Languages/French.php (100%) create mode 100644 auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/Galego.php rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Languages/German.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Languages/Greek.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Languages/Japanese.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Languages/LanguageInterface.php (100%) create mode 100644 auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/Portuguese.php rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Languages/Spanish.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/OutOfSequenceBeforeAuthenticationCallException.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/OutOfSequenceBeforeClientException.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/OutOfSequenceBeforeProxyException.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/OutOfSequenceException.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/PGTStorage/AbstractStorage.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/PGTStorage/Db.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/PGTStorage/File.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/ProxiedService.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/ProxiedService/Abstract.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/ProxiedService/Exception.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/ProxiedService/Http.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/ProxiedService/Http/Abstract.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/ProxiedService/Http/Get.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/ProxiedService/Http/Post.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/ProxiedService/Imap.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/ProxiedService/Testable.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/ProxyChain.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/ProxyChain/AllowedList.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/ProxyChain/Any.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/ProxyChain/Interface.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/ProxyChain/Trusted.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/ProxyTicketException.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Request/AbstractRequest.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Request/CurlMultiRequest.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Request/CurlRequest.php (98%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Request/Exception.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Request/MultiRequestInterface.php (100%) rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/Request/RequestInterface.php (100%) create mode 100644 auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Session/PhpSession.php rename auth/cas/CAS/{ => vendor/apereo/phpcas/source}/CAS/TypeMismatchException.php (100%) create mode 100644 auth/cas/CAS/vendor/autoload.php create mode 100644 auth/cas/CAS/vendor/composer/ClassLoader.php create mode 100644 auth/cas/CAS/vendor/composer/InstalledVersions.php create mode 100644 auth/cas/CAS/vendor/composer/LICENSE create mode 100644 auth/cas/CAS/vendor/composer/autoload_classmap.php create mode 100644 auth/cas/CAS/vendor/composer/autoload_namespaces.php create mode 100644 auth/cas/CAS/vendor/composer/autoload_psr4.php create mode 100644 auth/cas/CAS/vendor/composer/autoload_real.php create mode 100644 auth/cas/CAS/vendor/composer/autoload_static.php create mode 100644 auth/cas/CAS/vendor/composer/installed.json create mode 100644 auth/cas/CAS/vendor/composer/installed.php create mode 100644 auth/cas/CAS/vendor/composer/platform_check.php create mode 100644 auth/cas/CAS/vendor/psr/log/LICENSE create mode 100644 auth/cas/CAS/vendor/psr/log/Psr/Log/AbstractLogger.php create mode 100644 auth/cas/CAS/vendor/psr/log/Psr/Log/InvalidArgumentException.php create mode 100644 auth/cas/CAS/vendor/psr/log/Psr/Log/LogLevel.php create mode 100644 auth/cas/CAS/vendor/psr/log/Psr/Log/LoggerAwareInterface.php create mode 100644 auth/cas/CAS/vendor/psr/log/Psr/Log/LoggerAwareTrait.php create mode 100644 auth/cas/CAS/vendor/psr/log/Psr/Log/LoggerInterface.php create mode 100644 auth/cas/CAS/vendor/psr/log/Psr/Log/LoggerTrait.php create mode 100644 auth/cas/CAS/vendor/psr/log/Psr/Log/NullLogger.php create mode 100644 auth/cas/CAS/vendor/psr/log/Psr/Log/Test/DummyTest.php create mode 100644 auth/cas/CAS/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php create mode 100644 auth/cas/CAS/vendor/psr/log/Psr/Log/Test/TestLogger.php create mode 100644 auth/cas/CAS/vendor/psr/log/README.md create mode 100644 auth/cas/CAS/vendor/psr/log/composer.json diff --git a/auth/cas/CAS/moodle_readme.txt b/auth/cas/CAS/moodle_readme.txt deleted file mode 100644 index 6b4a85fd526..00000000000 --- a/auth/cas/CAS/moodle_readme.txt +++ /dev/null @@ -1,3 +0,0 @@ -Description of phpCAS 1.3.8 library import - -* downloaded source code from https://github.com/apereo/phpCAS/releases \ No newline at end of file diff --git a/auth/cas/CAS/vendor/apereo/phpcas/CAS.php b/auth/cas/CAS/vendor/apereo/phpcas/CAS.php new file mode 100644 index 00000000000..f38e7b113ab --- /dev/null +++ b/auth/cas/CAS/vendor/apereo/phpcas/CAS.php @@ -0,0 +1,32 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ + +require_once __DIR__.'/source/CAS.php'; + +trigger_error('Including CAS.php is deprecated. Install phpCAS using composer instead.', E_USER_DEPRECATED); diff --git a/auth/cas/CAS/LICENSE b/auth/cas/CAS/vendor/apereo/phpcas/LICENSE similarity index 100% rename from auth/cas/CAS/LICENSE rename to auth/cas/CAS/vendor/apereo/phpcas/LICENSE diff --git a/auth/cas/CAS/NOTICE b/auth/cas/CAS/vendor/apereo/phpcas/NOTICE similarity index 100% rename from auth/cas/CAS/NOTICE rename to auth/cas/CAS/vendor/apereo/phpcas/NOTICE diff --git a/auth/cas/CAS/README.md b/auth/cas/CAS/vendor/apereo/phpcas/README.md similarity index 85% rename from auth/cas/CAS/README.md rename to auth/cas/CAS/vendor/apereo/phpcas/README.md index f425edca84d..0dbc9258af1 100644 --- a/auth/cas/CAS/README.md +++ b/auth/cas/CAS/vendor/apereo/phpcas/README.md @@ -6,22 +6,21 @@ users via a Central Authentication Service (CAS) server. Please see the wiki website for more information: -https://wiki.jasig.org/display/CASC/phpCAS +https://apereo.github.io/phpCAS/ Api documentation can be found here: -https://apereo.github.io/phpCAS/ +https://apereo.github.io/phpCAS/api/ [![Build Status](https://travis-ci.org/apereo/phpCAS.png)](https://travis-ci.org/apereo/phpCAS) - LICENSE ------- -Copyright 2007-2015, JA-SIG, Inc. -This project includes software developed by Jasig. -http://www.jasig.org/ +Copyright 2007-2020, Apereo Foundation. +This project includes software developed by Apereo Foundation. +http://www.apereo.org/ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License. diff --git a/auth/cas/CAS/vendor/apereo/phpcas/composer.json b/auth/cas/CAS/vendor/apereo/phpcas/composer.json new file mode 100644 index 00000000000..e6e504e9c0c --- /dev/null +++ b/auth/cas/CAS/vendor/apereo/phpcas/composer.json @@ -0,0 +1,51 @@ +{ + "name" : "apereo/phpcas", + "description" : "Provides a simple API for authenticating users against a CAS server", + "keywords" : [ + "cas", + "jasig", + "apereo" + ], + "homepage" : "https://wiki.jasig.org/display/CASC/phpCAS", + "type" : "library", + "license" : "Apache-2.0", + "authors" : [{ + "name" : "Joachim Fritschi", + "homepage" : "https://github.com/jfritschi", + "email" : "jfritschi@freenet.de" + }, { + "name" : "Adam Franco", + "homepage" : "https://github.com/adamfranco" + }, { + "name" : "Henry Pan", + "homepage" : "https://github.com/phy25" + } + ], + "require" : { + "php" : ">=7.0.0", + "ext-curl" : "*", + "psr/log" : "^1.0.0" + }, + "require-dev" : { + "monolog/monolog" : "^1.0.0", + "phpunit/phpunit" : ">=4.8.35 <8" + }, + "autoload" : { + "classmap" : [ + "source/" + ] + }, + "autoload-dev" : { + "psr-4" : { + "PhpCas\\" : "test/CAS/" + } + }, + "scripts" : { + "test" : "phpunit" + }, + "extra" : { + "branch-alias" : { + "dev-master" : "1.3.x-dev" + } + } +} \ No newline at end of file diff --git a/auth/cas/CAS/vendor/apereo/phpcas/phpunit.xml.dist b/auth/cas/CAS/vendor/apereo/phpcas/phpunit.xml.dist new file mode 100644 index 00000000000..20cb6c62a06 --- /dev/null +++ b/auth/cas/CAS/vendor/apereo/phpcas/phpunit.xml.dist @@ -0,0 +1,21 @@ + + + + + + test/CAS/Tests/ + + + + + + source/ + + + diff --git a/auth/cas/CAS/CAS.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS.php similarity index 94% rename from auth/cas/CAS/CAS.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS.php index 343a3eb199d..045c9162646 100644 --- a/auth/cas/CAS/CAS.php +++ b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS.php @@ -35,6 +35,7 @@ * @ingroup public */ +use Psr\Log\LoggerInterface; // // hack by Vangelis Haniotakis to handle the absence of $_SERVER['REQUEST_URI'] @@ -44,11 +45,6 @@ if (!isset($_SERVER['REQUEST_URI']) && isset($_SERVER['SCRIPT_NAME']) && isset($ $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING']; } -// Add a E_USER_DEPRECATED for php versions <= 5.2 -if (!defined('E_USER_DEPRECATED')) { - define('E_USER_DEPRECATED', E_USER_NOTICE); -} - // ######################################################################## // CONSTANTS @@ -61,7 +57,7 @@ if (!defined('E_USER_DEPRECATED')) { /** * phpCAS version. accessible for the user by phpCAS::getVersion(). */ -define('PHPCAS_VERSION', '1.3.8'); +define('PHPCAS_VERSION', '1.4.0'); /** * @addtogroup public @@ -224,6 +220,8 @@ define("PHPCAS_LANG_JAPANESE", 'CAS_Languages_Japanese'); define("PHPCAS_LANG_SPANISH", 'CAS_Languages_Spanish'); define("PHPCAS_LANG_CATALAN", 'CAS_Languages_Catalan'); define("PHPCAS_LANG_CHINESE_SIMPLIFIED", 'CAS_Languages_ChineseSimplified'); +define("PHPCAS_LANG_GALEGO", 'CAS_Languages_Galego'); +define("PHPCAS_LANG_PORTUGUESE", 'CAS_Languages_Portuguese'); /** @} */ @@ -261,7 +259,7 @@ define('DEFAULT_DEBUG_DIR', gettmpdir()."/"); /** @} */ // include the class autoloader -require_once dirname(__FILE__) . '/CAS/Autoload.php'; +require_once __DIR__ . '/CAS/Autoload.php'; /** * The phpCAS class is a simple container for the phpCAS library. It provides CAS @@ -330,12 +328,14 @@ class phpCAS /** * phpCAS client initializer. * - * @param string $server_version the version of the CAS server - * @param string $server_hostname the hostname of the CAS server - * @param int $server_port the port the CAS server is running on - * @param string $server_uri the URI the CAS server is responding on - * @param bool $changeSessionID Allow phpCAS to change the session_id (Single - * Sign Out/handleLogoutRequests is based on that change) + * @param string $server_version the version of the CAS server + * @param string $server_hostname the hostname of the CAS server + * @param int $server_port the port the CAS server is running on + * @param string $server_uri the URI the CAS server is responding on + * @param bool $changeSessionID Allow phpCAS to change the session_id + * (Single Sign Out/handleLogoutRequests + * is based on that change) + * @param \SessionHandlerInterface $sessionHandler the session handler * * @return void a newly created CAS_Client object * @note Only one of the phpCAS::client() and phpCAS::proxy functions should be @@ -343,7 +343,7 @@ class phpCAS * and phpCAS::setDebug()). */ public static function client($server_version, $server_hostname, - $server_port, $server_uri, $changeSessionID = true + $server_port, $server_uri, $changeSessionID = true, \SessionHandlerInterface $sessionHandler = null ) { phpCAS :: traceBegin(); if (is_object(self::$_PHPCAS_CLIENT)) { @@ -363,7 +363,7 @@ class phpCAS try { self::$_PHPCAS_CLIENT = new CAS_Client( $server_version, false, $server_hostname, $server_port, $server_uri, - $changeSessionID + $changeSessionID, $sessionHandler ); } catch (Exception $e) { phpCAS :: error(get_class($e) . ': ' . $e->getMessage()); @@ -374,12 +374,14 @@ class phpCAS /** * phpCAS proxy initializer. * - * @param string $server_version the version of the CAS server - * @param string $server_hostname the hostname of the CAS server - * @param int $server_port the port the CAS server is running on - * @param string $server_uri the URI the CAS server is responding on - * @param bool $changeSessionID Allow phpCAS to change the session_id (Single - * Sign Out/handleLogoutRequests is based on that change) + * @param string $server_version the version of the CAS server + * @param string $server_hostname the hostname of the CAS server + * @param string $server_port the port the CAS server is running on + * @param string $server_uri the URI the CAS server is responding on + * @param bool $changeSessionID Allow phpCAS to change the session_id + * (Single Sign Out/handleLogoutRequests + * is based on that change) + * @param \SessionHandlerInterface $sessionHandler the session handler * * @return void a newly created CAS_Client object * @note Only one of the phpCAS::client() and phpCAS::proxy functions should be @@ -387,7 +389,7 @@ class phpCAS * and phpCAS::setDebug()). */ public static function proxy($server_version, $server_hostname, - $server_port, $server_uri, $changeSessionID = true + $server_port, $server_uri, $changeSessionID = true, \SessionHandlerInterface $sessionHandler = null ) { phpCAS :: traceBegin(); if (is_object(self::$_PHPCAS_CLIENT)) { @@ -407,7 +409,7 @@ class phpCAS try { self::$_PHPCAS_CLIENT = new CAS_Client( $server_version, true, $server_hostname, $server_port, $server_uri, - $changeSessionID + $changeSessionID, $sessionHandler ); } catch (Exception $e) { phpCAS :: error(get_class($e) . ': ' . $e->getMessage()); @@ -435,6 +437,24 @@ class phpCAS * @{ */ + /** + * Set/unset PSR-3 logger + * + * @param LoggerInterface $logger the PSR-3 logger used for logging, or + * null to stop logging. + * + * @return void + */ + public static function setLogger($logger = null) + { + if (empty(self::$_PHPCAS_DEBUG['unique_id'])) { + self::$_PHPCAS_DEBUG['unique_id'] = substr(strtoupper(md5(uniqid(''))), 0, 4); + } + self::$_PHPCAS_DEBUG['logger'] = $logger; + self::$_PHPCAS_DEBUG['indent'] = 0; + phpCAS :: trace('START ('.date("Y-m-d H:i:s").') phpCAS-' . PHPCAS_VERSION . ' ******************'); + } + /** * Set/unset debug mode * @@ -442,9 +462,13 @@ class phpCAS * to stop debugging. * * @return void + * + * @deprecated */ public static function setDebug($filename = '') { + trigger_error('phpCAS::setDebug() is deprecated in favor of phpCAS::setLogger().', E_USER_DEPRECATED); + if ($filename != false && gettype($filename) != 'string') { phpCAS :: error('type mismatched for parameter $dbg (should be false or the name of the log file)'); } @@ -518,14 +542,7 @@ class phpCAS $indent_str = "."; - if (!empty(self::$_PHPCAS_DEBUG['filename'])) { - // Check if file exists and modifiy file permissions to be only - // readable by the webserver - if (!file_exists(self::$_PHPCAS_DEBUG['filename'])) { - touch(self::$_PHPCAS_DEBUG['filename']); - // Chmod will fail on windows - @chmod(self::$_PHPCAS_DEBUG['filename'], 0600); - } + if (isset(self::$_PHPCAS_DEBUG['logger']) || !empty(self::$_PHPCAS_DEBUG['filename'])) { for ($i = 0; $i < self::$_PHPCAS_DEBUG['indent']; $i++) { $indent_str .= '| '; @@ -533,7 +550,20 @@ class phpCAS // allow for multiline output with proper identing. Usefull for // dumping cas answers etc. $str2 = str_replace("\n", "\n" . self::$_PHPCAS_DEBUG['unique_id'] . ' ' . $indent_str, $str); - error_log(self::$_PHPCAS_DEBUG['unique_id'] . ' ' . $indent_str . $str2 . "\n", 3, self::$_PHPCAS_DEBUG['filename']); + $str3 = self::$_PHPCAS_DEBUG['unique_id'] . ' ' . $indent_str . $str2; + if (isset(self::$_PHPCAS_DEBUG['logger'])) { + self::$_PHPCAS_DEBUG['logger']->info($str3); + } + if (!empty(self::$_PHPCAS_DEBUG['filename'])) { + // Check if file exists and modifiy file permissions to be only + // readable by the webserver + if (!file_exists(self::$_PHPCAS_DEBUG['filename'])) { + touch(self::$_PHPCAS_DEBUG['filename']); + // Chmod will fail on windows + @chmod(self::$_PHPCAS_DEBUG['filename'], 0600); + } + error_log($str3 . "\n", 3, self::$_PHPCAS_DEBUG['filename']); + } } } @@ -1869,6 +1899,14 @@ class phpCAS } } + /** + * @return CAS_Client + */ + public static function getCasClient() + { + return self::$_PHPCAS_CLIENT; + } + /** * For testing purposes, use this method to set the client to a test double * diff --git a/auth/cas/CAS/CAS/AuthenticationException.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/AuthenticationException.php similarity index 100% rename from auth/cas/CAS/CAS/AuthenticationException.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/AuthenticationException.php diff --git a/auth/cas/CAS/CAS/Autoload.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Autoload.php similarity index 77% rename from auth/cas/CAS/CAS/Autoload.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Autoload.php index 5e9b140c78a..ee803cbf1dd 100644 --- a/auth/cas/CAS/CAS/Autoload.php +++ b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Autoload.php @@ -26,18 +26,24 @@ function CAS_autoload($class) // Static to hold the Include Path to CAS static $include_path; // Check only for CAS classes - if (substr($class, 0, 4) !== 'CAS_') { + if (substr($class, 0, 4) !== 'CAS_' && substr($class, 0, 7) !== 'PhpCas\\') { return false; } + // Setup the include path if it's not already set from a previous call if (empty($include_path)) { - $include_path = array(dirname(dirname(__FILE__)), dirname(dirname(__FILE__)) . '/../test/' ); + $include_path = array(dirname(__DIR__)); } // Declare local variable to store the expected full path to the file - foreach ($include_path as $path) { - $file_path = $path . '/' . str_replace('_', '/', $class) . '.php'; + $class_path = str_replace('_', DIRECTORY_SEPARATOR, $class); + // PhpCas namespace mapping + if (substr($class_path, 0, 7) === 'PhpCas\\') { + $class_path = 'CAS' . DIRECTORY_SEPARATOR . substr($class_path, 7); + } + + $file_path = $path . DIRECTORY_SEPARATOR . $class_path . '.php'; $fp = @fopen($file_path, 'r', true); if ($fp) { fclose($fp); @@ -54,6 +60,7 @@ function CAS_autoload($class) return true; } } + $e = new Exception( 'Class ' . $class . ' could not be loaded from ' . $file_path . ', file does not exist (Path="' @@ -73,10 +80,10 @@ function CAS_autoload($class) die ((string) $e); } -// set up __autoload -if (!(spl_autoload_functions()) - || !in_array('CAS_autoload', spl_autoload_functions()) -) { +// Set up autoload if not already configured by composer. +if (!class_exists('CAS_Client')) +{ + trigger_error('phpCAS autoloader is deprecated. Install phpCAS using composer instead.', E_USER_DEPRECATED); spl_autoload_register('CAS_autoload'); if (function_exists('__autoload') && !in_array('__autoload', spl_autoload_functions()) @@ -85,6 +92,4 @@ if (!(spl_autoload_functions()) // it to the autoload stack spl_autoload_register('__autoload'); } -} - -?> +} \ No newline at end of file diff --git a/auth/cas/CAS/CAS/Client.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Client.php similarity index 82% rename from auth/cas/CAS/CAS/Client.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Client.php index f06c1540568..91374973c8c 100644 --- a/auth/cas/CAS/CAS/Client.php +++ b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Client.php @@ -27,6 +27,7 @@ * @author Brett Bieber * @author Joachim Fritschi * @author Adam Franco + * @author Tobias Schiebeck * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * @link https://wiki.jasig.org/display/CASC/phpCAS */ @@ -43,6 +44,7 @@ * @author Brett Bieber * @author Joachim Fritschi * @author Adam Franco + * @author Tobias Schiebeck * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * @link https://wiki.jasig.org/display/CASC/phpCAS * @@ -149,9 +151,9 @@ class CAS_Client */ public function setHTMLHeader($header) { - // Argument Validation - if (gettype($header) != 'string') - throw new CAS_TypeMismatchException($header, '$header', 'string'); + // Argument Validation + if (gettype($header) != 'string') + throw new CAS_TypeMismatchException($header, '$header', 'string'); $this->_output_header = $header; } @@ -165,9 +167,9 @@ class CAS_Client */ public function setHTMLFooter($footer) { - // Argument Validation - if (gettype($footer) != 'string') - throw new CAS_TypeMismatchException($footer, '$footer', 'string'); + // Argument Validation + if (gettype($footer) != 'string') + throw new CAS_TypeMismatchException($footer, '$footer', 'string'); $this->_output_footer = $footer; } @@ -200,9 +202,9 @@ class CAS_Client */ public function setLang($lang) { - // Argument Validation - if (gettype($lang) != 'string') - throw new CAS_TypeMismatchException($lang, '$lang', 'string'); + // Argument Validation + if (gettype($lang) != 'string') + throw new CAS_TypeMismatchException($lang, '$lang', 'string'); phpCAS::traceBegin(); $obj = new $lang(); @@ -364,9 +366,9 @@ class CAS_Client */ public function setServerLoginURL($url) { - // Argument Validation - if (gettype($url) != 'string') - throw new CAS_TypeMismatchException($url, '$url', 'string'); + // Argument Validation + if (gettype($url) != 'string') + throw new CAS_TypeMismatchException($url, '$url', 'string'); return $this->_server['login_url'] = $url; } @@ -381,9 +383,9 @@ class CAS_Client */ public function setServerServiceValidateURL($url) { - // Argument Validation - if (gettype($url) != 'string') - throw new CAS_TypeMismatchException($url, '$url', 'string'); + // Argument Validation + if (gettype($url) != 'string') + throw new CAS_TypeMismatchException($url, '$url', 'string'); return $this->_server['service_validate_url'] = $url; } @@ -398,9 +400,9 @@ class CAS_Client */ public function setServerProxyValidateURL($url) { - // Argument Validation - if (gettype($url) != 'string') - throw new CAS_TypeMismatchException($url, '$url', 'string'); + // Argument Validation + if (gettype($url) != 'string') + throw new CAS_TypeMismatchException($url, '$url', 'string'); return $this->_server['proxy_validate_url'] = $url; } @@ -415,9 +417,9 @@ class CAS_Client */ public function setServerSamlValidateURL($url) { - // Argument Validation - if (gettype($url) != 'string') - throw new CAS_TypeMismatchException($url, '$url', 'string'); + // Argument Validation + if (gettype($url) != 'string') + throw new CAS_TypeMismatchException($url, '$url', 'string'); return $this->_server['saml_validate_url'] = $url; } @@ -556,9 +558,9 @@ class CAS_Client */ public function setServerLogoutURL($url) { - // Argument Validation - if (gettype($url) != 'string') - throw new CAS_TypeMismatchException($url, '$url', 'string'); + // Argument Validation + if (gettype($url) != 'string') + throw new CAS_TypeMismatchException($url, '$url', 'string'); return $this->_server['logout_url'] = $url; } @@ -888,14 +890,15 @@ class CAS_Client /** * CAS_Client constructor. * - * @param string $server_version the version of the CAS server - * @param bool $proxy true if the CAS client is a CAS proxy - * @param string $server_hostname the hostname of the CAS server - * @param int $server_port the port the CAS server is running on - * @param string $server_uri the URI the CAS server is responding on - * @param bool $changeSessionID Allow phpCAS to change the session_id - * (Single Sign Out/handleLogoutRequests - * is based on that change) + * @param string $server_version the version of the CAS server + * @param bool $proxy true if the CAS client is a CAS proxy + * @param string $server_hostname the hostname of the CAS server + * @param int $server_port the port the CAS server is running on + * @param string $server_uri the URI the CAS server is responding on + * @param bool $changeSessionID Allow phpCAS to change the session_id + * (Single Sign Out/handleLogoutRequests + * is based on that change) + * @param \SessionHandlerInterface $sessionHandler the session handler * * @return self a newly created CAS_Client object */ @@ -905,35 +908,50 @@ class CAS_Client $server_hostname, $server_port, $server_uri, - $changeSessionID = true + $changeSessionID = true, + \SessionHandlerInterface $sessionHandler = null ) { - // Argument validation + // Argument validation if (gettype($server_version) != 'string') - throw new CAS_TypeMismatchException($server_version, '$server_version', 'string'); + throw new CAS_TypeMismatchException($server_version, '$server_version', 'string'); if (gettype($proxy) != 'boolean') - throw new CAS_TypeMismatchException($proxy, '$proxy', 'boolean'); + throw new CAS_TypeMismatchException($proxy, '$proxy', 'boolean'); if (gettype($server_hostname) != 'string') - throw new CAS_TypeMismatchException($server_hostname, '$server_hostname', 'string'); + throw new CAS_TypeMismatchException($server_hostname, '$server_hostname', 'string'); if (gettype($server_port) != 'integer') - throw new CAS_TypeMismatchException($server_port, '$server_port', 'integer'); + throw new CAS_TypeMismatchException($server_port, '$server_port', 'integer'); if (gettype($server_uri) != 'string') - throw new CAS_TypeMismatchException($server_uri, '$server_uri', 'string'); + throw new CAS_TypeMismatchException($server_uri, '$server_uri', 'string'); if (gettype($changeSessionID) != 'boolean') - throw new CAS_TypeMismatchException($changeSessionID, '$changeSessionID', 'boolean'); + throw new CAS_TypeMismatchException($changeSessionID, '$changeSessionID', 'boolean'); + + if (empty($sessionHandler)) { + $sessionHandler = new CAS_Session_PhpSession; + } phpCAS::traceBegin(); // true : allow to change the session_id(), false session_id won't be - // change and logout won't be handle because of that + // changed and logout won't be handled because of that $this->_setChangeSessionID($changeSessionID); - // skip Session Handling for logout requests and if don't want it' - if (session_id()=="" && !$this->_isLogoutRequest()) { - session_start(); - phpCAS :: trace("Starting a new session " . session_id()); + $this->setSessionHandler($sessionHandler); + + if (!$this->_isLogoutRequest()) { + if (session_id() === "") { + // skip Session Handling for logout requests and if don't want it + session_start(); + phpCAS :: trace("Starting a new session " . session_id()); + } + // init phpCAS session array + if (!isset($_SESSION[static::PHPCAS_SESSION_PREFIX]) + || !is_array($_SESSION[static::PHPCAS_SESSION_PREFIX])) { + $_SESSION[static::PHPCAS_SESSION_PREFIX] = array(); + } } + // Only for debug purposes if ($this->isSessionAuthenticated()){ - phpCAS :: trace("Session is authenticated as: " . $_SESSION['phpCAS']['user']); + phpCAS :: trace("Session is authenticated as: " . $this->getSessionValue('user')); } else { phpCAS :: trace("Session is not authenticated"); } @@ -942,14 +960,12 @@ class CAS_Client // Make cookie handling available. if ($this->isProxy()) { - if (!isset($_SESSION['phpCAS'])) { - $_SESSION['phpCAS'] = array(); - } - if (!isset($_SESSION['phpCAS']['service_cookies'])) { - $_SESSION['phpCAS']['service_cookies'] = array(); + if (!$this->hasSessionValue('service_cookies')) { + $this->setSessionValue('service_cookies', array()); } + // TODO remove explicit call to $_SESSION $this->_serviceCookieJar = new CAS_CookieJar( - $_SESSION['phpCAS']['service_cookies'] + $_SESSION[static::PHPCAS_SESSION_PREFIX]['service_cookies'] ); } @@ -1008,7 +1024,7 @@ class CAS_Client $this->_setCallbackModeUsingPost(false); } - + } if ( $this->_isCallbackMode() ) { @@ -1051,6 +1067,8 @@ class CAS_Client * @{ */ + /** The session prefix for phpCAS values */ + const PHPCAS_SESSION_PREFIX = 'phpCAS'; /** * @var bool A variable to whether phpcas will use its own session handling. Default = true @@ -1058,6 +1076,11 @@ class CAS_Client */ private $_change_session_id = true; + /** + * @var SessionHandlerInterface + */ + private $_sessionHandler; + /** * Set a parameter whether to allow phpCAS to change session_id * @@ -1080,6 +1103,149 @@ class CAS_Client return $this->_change_session_id; } + /** + * Set the session handler. + * + * @param \SessionHandlerInterface $sessionHandler + * + * @return bool + */ + public function setSessionHandler(\SessionHandlerInterface $sessionHandler) + { + $this->_sessionHandler = $sessionHandler; + if (session_status() !== PHP_SESSION_ACTIVE) { + return session_set_save_handler($this->_sessionHandler, true); + } + return true; + } + + /** + * Get a session value using the given key. + * + * @param string $key + * @param mixed $default default value if the key is not set + * + * @return mixed + */ + protected function getSessionValue($key, $default = null) + { + $this->validateSession($key); + + if (isset($_SESSION[static::PHPCAS_SESSION_PREFIX][$key])) { + return $_SESSION[static::PHPCAS_SESSION_PREFIX][$key]; + } + + return $default; + } + + /** + * Determine whether a session value is set or not. + * + * To check if a session value is empty or not please use + * !!(getSessionValue($key)). + * + * @param string $key + * + * @return bool + */ + protected function hasSessionValue($key) + { + $this->validateSession($key); + + return isset($_SESSION[static::PHPCAS_SESSION_PREFIX][$key]); + } + + /** + * Set a session value using the given key and value. + * + * @param string $key + * @param mixed $value + * + * @return string + */ + protected function setSessionValue($key, $value) + { + $this->validateSession($key); + + $_SESSION[static::PHPCAS_SESSION_PREFIX][$key] = $value; + } + + /** + * Remove a session value with the given key. + * + * @param string $key + */ + protected function removeSessionValue($key) + { + $this->validateSession($key); + + if (isset($_SESSION[static::PHPCAS_SESSION_PREFIX][$key])) { + unset($_SESSION[static::PHPCAS_SESSION_PREFIX][$key]); + return true; + } + + return false; + } + + /** + * Remove all phpCAS session values. + */ + protected function clearSessionValues() + { + unset($_SESSION[static::PHPCAS_SESSION_PREFIX]); + } + + /** + * Ensure $key is a string for session utils input + * + * @param string $key + * + * @return bool + */ + protected function validateSession($key) + { + if (!is_string($key)) { + throw new InvalidArgumentException('Session key must be a string.'); + } + + return true; + } + + /** + * Renaming the session + * + * @param string $ticket name of the ticket + * + * @return void + */ + protected function _renameSession($ticket) + { + phpCAS::traceBegin(); + if ($this->getChangeSessionID()) { + if (!empty($this->_user)) { + $old_session = $_SESSION; + phpCAS :: trace("Killing session: ". session_id()); + session_destroy(); + // set up a new session, of name based on the ticket + $session_id = $this->_sessionIdForTicket($ticket); + phpCAS :: trace("Starting session: ". $session_id); + session_id($session_id); + session_start(); + phpCAS :: trace("Restoring old session vars"); + $_SESSION = $old_session; + } else { + phpCAS :: trace ( + 'Session should only be renamed after successfull authentication' + ); + } + } else { + phpCAS :: trace( + "Skipping session rename since phpCAS is not handling the session." + ); + } + phpCAS::traceEnd(); + } + /** @} */ // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @@ -1123,10 +1289,10 @@ class CAS_Client */ public function getUser() { - // Sequence validation - $this->ensureAuthenticationCallSuccessful(); + // Sequence validation + $this->ensureAuthenticationCallSuccessful(); - return $this->_getUser(); + return $this->_getUser(); } /** @@ -1139,7 +1305,7 @@ class CAS_Client */ private function _getUser() { - // This is likely a duplicate check that could be removed.... + // This is likely a duplicate check that could be removed.... if ( empty($this->_user) ) { phpCAS::error( 'this method should be used only after '.__CLASS__ @@ -1177,9 +1343,9 @@ class CAS_Client */ public function getAttributes() { - // Sequence validation - $this->ensureAuthenticationCallSuccessful(); - // This is likely a duplicate check that could be removed.... + // Sequence validation + $this->ensureAuthenticationCallSuccessful(); + // This is likely a duplicate check that could be removed.... if ( empty($this->_user) ) { // if no user is set, there shouldn't be any attributes also... phpCAS::error( @@ -1197,8 +1363,8 @@ class CAS_Client */ public function hasAttributes() { - // Sequence validation - $this->ensureAuthenticationCallSuccessful(); + // Sequence validation + $this->ensureAuthenticationCallSuccessful(); return !empty($this->_attributes); } @@ -1211,8 +1377,8 @@ class CAS_Client */ public function hasAttribute($key) { - // Sequence validation - $this->ensureAuthenticationCallSuccessful(); + // Sequence validation + $this->ensureAuthenticationCallSuccessful(); return $this->_hasAttribute($key); } @@ -1239,8 +1405,8 @@ class CAS_Client */ public function getAttribute($key) { - // Sequence validation - $this->ensureAuthenticationCallSuccessful(); + // Sequence validation + $this->ensureAuthenticationCallSuccessful(); if ($this->_hasAttribute($key)) { return $this->_attributes[$key]; @@ -1258,9 +1424,7 @@ class CAS_Client { phpCAS::traceBegin(); // Either way, the user is authenticated by CAS - if (isset( $_SESSION['phpCAS']['auth_checked'])) { - unset($_SESSION['phpCAS']['auth_checked']); - } + $this->removeSessionValue('auth_checked'); if ( $this->isAuthenticated(true) ) { phpCAS::trace('user already authenticated'); $res = true; @@ -1289,9 +1453,7 @@ class CAS_Client $res = true; } else { // the user is not authenticated, redirect to the CAS server - if (isset($_SESSION['phpCAS']['auth_checked'])) { - unset($_SESSION['phpCAS']['auth_checked']); - } + $this->removeSessionValue('auth_checked'); $this->redirectToCas(false/* no gateway */); // never reached $res = false; @@ -1317,8 +1479,8 @@ class CAS_Client */ public function setCacheTimesForAuthRecheck($n) { - if (gettype($n) != 'integer') - throw new CAS_TypeMismatchException($n, '$n', 'string'); + if (gettype($n) != 'integer') + throw new CAS_TypeMismatchException($n, '$n', 'string'); $this->_cache_times_for_auth_recheck = $n; } @@ -1333,34 +1495,31 @@ class CAS_Client public function checkAuthentication() { phpCAS::traceBegin(); + $res = false; // default if ( $this->isAuthenticated() ) { phpCAS::trace('user is authenticated'); /* The 'auth_checked' variable is removed just in case it's set. */ - unset($_SESSION['phpCAS']['auth_checked']); + $this->removeSessionValue('auth_checked'); $res = true; - } else if (isset($_SESSION['phpCAS']['auth_checked'])) { + } else if ($this->getSessionValue('auth_checked')) { // the previous request has redirected the client to the CAS server // with gateway=true - unset($_SESSION['phpCAS']['auth_checked']); - $res = false; + $this->removeSessionValue('auth_checked'); } else { // avoid a check against CAS on every request - if (!isset($_SESSION['phpCAS']['unauth_count'])) { - $_SESSION['phpCAS']['unauth_count'] = -2; // uninitialized - } + // we need to write this back to session later + $unauth_count = $this->getSessionValue('unauth_count', -2); - if (($_SESSION['phpCAS']['unauth_count'] != -2 + if (($unauth_count != -2 && $this->_cache_times_for_auth_recheck == -1) - || ($_SESSION['phpCAS']['unauth_count'] >= 0 - && $_SESSION['phpCAS']['unauth_count'] < $this->_cache_times_for_auth_recheck) + || ($unauth_count >= 0 + && $unauth_count < $this->_cache_times_for_auth_recheck) ) { - $res = false; - if ($this->_cache_times_for_auth_recheck != -1) { - $_SESSION['phpCAS']['unauth_count']++; + $unauth_count++; phpCAS::trace( 'user is not authenticated (cached for ' - .$_SESSION['phpCAS']['unauth_count'].' times of ' + .$unauth_count.' times of ' .$this->_cache_times_for_auth_recheck.')' ); } else { @@ -1368,13 +1527,13 @@ class CAS_Client 'user is not authenticated (cached for until login pressed)' ); } + $this->setSessionValue('unauth_count', $unauth_count); } else { - $_SESSION['phpCAS']['unauth_count'] = 0; - $_SESSION['phpCAS']['auth_checked'] = true; + $this->setSessionValue('unauth_count', 0); + $this->setSessionValue('auth_checked', true); phpCAS::trace('user is not authenticated (cache reset)'); $this->redirectToCas(true/* gateway */); // never reached - $res = false; } } phpCAS::traceEnd($res); @@ -1440,7 +1599,7 @@ class CAS_Client phpCAS::trace( 'CAS 1.0 ticket `'.$this->getTicket().'\' was validated' ); - $_SESSION['phpCAS']['user'] = $this->_getUser(); + $this->setSessionValue('user', $this->_getUser()); $res = true; $logoutTicket = $this->getTicket(); break; @@ -1461,15 +1620,15 @@ class CAS_Client $validate_url, $text_response, $tree_response ); // idem phpCAS::trace('PGT `'.$this->_getPGT().'\' was validated'); - $_SESSION['phpCAS']['pgt'] = $this->_getPGT(); + $this->setSessionValue('pgt', $this->_getPGT()); } - $_SESSION['phpCAS']['user'] = $this->_getUser(); + $this->setSessionValue('user', $this->_getUser()); if (!empty($this->_attributes)) { - $_SESSION['phpCAS']['attributes'] = $this->_attributes; + $this->setSessionValue('attributes', $this->_attributes); } $proxies = $this->getProxies(); if (!empty($proxies)) { - $_SESSION['phpCAS']['proxies'] = $this->getProxies(); + $this->setSessionValue('proxies', $this->getProxies()); } $res = true; $logoutTicket = $this->getTicket(); @@ -1485,8 +1644,8 @@ class CAS_Client phpCAS::trace( 'SAML 1.1 ticket `'.$this->getTicket().'\' was validated' ); - $_SESSION['phpCAS']['user'] = $this->_getUser(); - $_SESSION['phpCAS']['attributes'] = $this->_attributes; + $this->setSessionValue('user', $this->_getUser()); + $this->setSessionValue('attributes', $this->_attributes); $res = true; $logoutTicket = $this->getTicket(); break; @@ -1540,7 +1699,7 @@ class CAS_Client */ public function isSessionAuthenticated () { - return !empty($_SESSION['phpCAS']['user']); + return !!$this->getSessionValue('user'); } /** @@ -1568,50 +1727,50 @@ class CAS_Client if ( $this->isProxy() ) { // CAS proxy: username and PGT must be present if ( $this->isSessionAuthenticated() - && !empty($_SESSION['phpCAS']['pgt']) + && $this->getSessionValue('pgt') ) { // authentication already done - $this->_setUser($_SESSION['phpCAS']['user']); - if (isset($_SESSION['phpCAS']['attributes'])) { - $this->setAttributes($_SESSION['phpCAS']['attributes']); + $this->_setUser($this->getSessionValue('user')); + if ($this->hasSessionValue('attributes')) { + $this->setAttributes($this->getSessionValue('attributes')); } - $this->_setPGT($_SESSION['phpCAS']['pgt']); + $this->_setPGT($this->getSessionValue('pgt')); phpCAS::trace( - 'user = `'.$_SESSION['phpCAS']['user'].'\', PGT = `' - .$_SESSION['phpCAS']['pgt'].'\'' + 'user = `'.$this->getSessionValue('user').'\', PGT = `' + .$this->getSessionValue('pgt').'\'' ); // Include the list of proxies - if (isset($_SESSION['phpCAS']['proxies'])) { - $this->_setProxies($_SESSION['phpCAS']['proxies']); + if ($this->hasSessionValue('proxies')) { + $this->_setProxies($this->getSessionValue('proxies')); phpCAS::trace( 'proxies = "' - .implode('", "', $_SESSION['phpCAS']['proxies']).'"' + .implode('", "', $this->getSessionValue('proxies')).'"' ); } $auth = true; } elseif ( $this->isSessionAuthenticated() - && empty($_SESSION['phpCAS']['pgt']) + && !$this->getSessionValue('pgt') ) { // these two variables should be empty or not empty at the same time phpCAS::trace( - 'username found (`'.$_SESSION['phpCAS']['user'] + 'username found (`'.$this->getSessionValue('user') .'\') but PGT is empty' ); // unset all tickets to enforce authentication - unset($_SESSION['phpCAS']); + $this->clearSessionValues(); $this->setTicket(''); } elseif ( !$this->isSessionAuthenticated() - && !empty($_SESSION['phpCAS']['pgt']) + && $this->getSessionValue('pgt') ) { // these two variables should be empty or not empty at the same time phpCAS::trace( - 'PGT found (`'.$_SESSION['phpCAS']['pgt'] + 'PGT found (`'.$this->getSessionValue('pgt') .'\') but username is empty' ); // unset all tickets to enforce authentication - unset($_SESSION['phpCAS']); + $this->clearSessionValues(); $this->setTicket(''); } else { phpCAS::trace('neither user nor PGT found'); @@ -1620,18 +1779,18 @@ class CAS_Client // `simple' CAS client (not a proxy): username must be present if ( $this->isSessionAuthenticated() ) { // authentication already done - $this->_setUser($_SESSION['phpCAS']['user']); - if (isset($_SESSION['phpCAS']['attributes'])) { - $this->setAttributes($_SESSION['phpCAS']['attributes']); + $this->_setUser($this->getSessionValue('user')); + if ($this->hasSessionValue('attributes')) { + $this->setAttributes($this->getSessionValue('attributes')); } - phpCAS::trace('user = `'.$_SESSION['phpCAS']['user'].'\''); + phpCAS::trace('user = `'.$this->getSessionValue('user').'\''); // Include the list of proxies - if (isset($_SESSION['phpCAS']['proxies'])) { - $this->_setProxies($_SESSION['phpCAS']['proxies']); + if ($this->hasSessionValue('proxies')) { + $this->_setProxies($this->getSessionValue('proxies')); phpCAS::trace( 'proxies = "' - .implode('", "', $_SESSION['phpCAS']['proxies']).'"' + .implode('", "', $this->getSessionValue('proxies')).'"' ); } @@ -1955,7 +2114,7 @@ class CAS_Client if (gettype($validate_cn) != 'boolean') { throw new CAS_TypeMismatchException($validate_cn, '$validate_cn', 'boolean'); } - if ( !file_exists($cert) && $this->_requestImplementation !== 'CAS_TestHarness_DummyRequest'){ + if (!file_exists($cert)) { throw new CAS_InvalidArgumentException("Certificate file does not exist " . $this->_requestImplementation); } $this->_cas_server_ca_cert = $cert; @@ -2410,11 +2569,11 @@ class CAS_Client */ public function setCallbackURL($url) { - // Sequence validation + // Sequence validation $this->ensureIsProxy(); - // Argument Validation - if (gettype($url) != 'string') - throw new CAS_TypeMismatchException($url, '$url', 'string'); + // Argument Validation + if (gettype($url) != 'string') + throw new CAS_TypeMismatchException($url, '$url', 'string'); return $this->_callback_url = $url; } @@ -2439,11 +2598,7 @@ class CAS_Client if (preg_match('/^[PT]GT-[\.\-\w]+$/', $pgtId)) { phpCAS::trace('Storing PGT `'.$pgtId.'\' (id=`'.$pgtIou.'\')'); $this->_storePGT($pgtId, $pgtIou); - if (array_key_exists('HTTP_ACCEPT', $_SERVER) && - ( $_SERVER['HTTP_ACCEPT'] == 'application/xml' || - $_SERVER['HTTP_ACCEPT'] == 'text/xml' - ) - ) { + if ($this->isXmlResponse()) { echo '' . "\r\n"; echo ''; phpCAS::traceExit("XML response sent"); @@ -2470,6 +2625,23 @@ class CAS_Client throw new CAS_GracefullTerminationException(); } + /** + * Check if application/xml or text/xml is pressent in HTTP_ACCEPT header values + * when return value is complex and contains attached q parameters. + * Example: HTTP_ACCEPT = text/html,application/xhtml+xml,application/xml;q=0.9 + * @return bool + */ + private function isXmlResponse() + { + if (!array_key_exists('HTTP_ACCEPT', $_SERVER)) { + return false; + } + if (strpos($_SERVER['HTTP_ACCEPT'], 'application/xml') === false && strpos($_SERVER['HTTP_ACCEPT'], 'text/xml') === false) { + return false; + } + + return true; + } /** @} */ @@ -2550,7 +2722,7 @@ class CAS_Client */ public function setPGTStorage($storage) { - // Sequence validation + // Sequence validation $this->ensureIsProxy(); // check that the storage has not already been set @@ -2586,18 +2758,18 @@ class CAS_Client public function setPGTStorageDb( $dsn_or_pdo, $username='', $password='', $table='', $driver_options=null ) { - // Sequence validation + // Sequence validation $this->ensureIsProxy(); - // Argument validation - if (!(is_object($dsn_or_pdo) && $dsn_or_pdo instanceof PDO) && !is_string($dsn_or_pdo)) - throw new CAS_TypeMismatchException($dsn_or_pdo, '$dsn_or_pdo', 'string or PDO object'); - if (gettype($username) != 'string') - throw new CAS_TypeMismatchException($username, '$username', 'string'); + // Argument validation + if (!(is_object($dsn_or_pdo) && $dsn_or_pdo instanceof PDO) && !is_string($dsn_or_pdo)) + throw new CAS_TypeMismatchException($dsn_or_pdo, '$dsn_or_pdo', 'string or PDO object'); + if (gettype($username) != 'string') + throw new CAS_TypeMismatchException($username, '$username', 'string'); if (gettype($password) != 'string') - throw new CAS_TypeMismatchException($password, '$password', 'string'); + throw new CAS_TypeMismatchException($password, '$password', 'string'); if (gettype($table) != 'string') - throw new CAS_TypeMismatchException($table, '$password', 'string'); + throw new CAS_TypeMismatchException($table, '$password', 'string'); // create the storage object $this->setPGTStorage( @@ -2617,12 +2789,12 @@ class CAS_Client */ public function setPGTStorageFile($path='') { - // Sequence validation + // Sequence validation $this->ensureIsProxy(); - // Argument validation - if (gettype($path) != 'string') - throw new CAS_TypeMismatchException($path, '$path', 'string'); + // Argument validation + if (gettype($path) != 'string') + throw new CAS_TypeMismatchException($path, '$path', 'string'); // create the storage object $this->setPGTStorage(new CAS_PGTStorage_File($this, $path)); @@ -2704,9 +2876,9 @@ class CAS_Client */ public function retrievePT($target_service,&$err_code,&$err_msg) { - // Argument validation - if (gettype($target_service) != 'string') - throw new CAS_TypeMismatchException($target_service, '$target_service', 'string'); + // Argument validation + if (gettype($target_service) != 'string') + throw new CAS_TypeMismatchException($target_service, '$target_service', 'string'); phpCAS::traceBegin(); @@ -2926,13 +3098,13 @@ class CAS_Client */ public function getProxiedService ($type) { - // Sequence validation + // Sequence validation $this->ensureIsProxy(); - $this->ensureAuthenticationCallSuccessful(); + $this->ensureAuthenticationCallSuccessful(); - // Argument validation - if (gettype($type) != 'string') - throw new CAS_TypeMismatchException($type, '$type', 'string'); + // Argument validation + if (gettype($type) != 'string') + throw new CAS_TypeMismatchException($type, '$type', 'string'); switch ($type) { case PHPCAS_PROXIED_SERVICE_HTTP_GET: @@ -2977,9 +3149,9 @@ class CAS_Client */ public function initializeProxiedService (CAS_ProxiedService $proxiedService) { - // Sequence validation + // Sequence validation $this->ensureIsProxy(); - $this->ensureAuthenticationCallSuccessful(); + $this->ensureAuthenticationCallSuccessful(); $url = $proxiedService->getServiceUrl(); if (!is_string($url)) { @@ -3012,13 +3184,13 @@ class CAS_Client */ public function serviceWeb($url,&$err_code,&$output) { - // Sequence validation + // Sequence validation $this->ensureIsProxy(); - $this->ensureAuthenticationCallSuccessful(); + $this->ensureAuthenticationCallSuccessful(); - // Argument validation - if (gettype($url) != 'string') - throw new CAS_TypeMismatchException($url, '$url', 'string'); + // Argument validation + if (gettype($url) != 'string') + throw new CAS_TypeMismatchException($url, '$url', 'string'); try { $service = $this->getProxiedService(PHPCAS_PROXIED_SERVICE_HTTP_GET); @@ -3062,17 +3234,17 @@ class CAS_Client */ public function serviceMail($url,$serviceUrl,$flags,&$err_code,&$err_msg,&$pt) { - // Sequence validation + // Sequence validation $this->ensureIsProxy(); - $this->ensureAuthenticationCallSuccessful(); + $this->ensureAuthenticationCallSuccessful(); - // Argument validation - if (gettype($url) != 'string') - throw new CAS_TypeMismatchException($url, '$url', 'string'); + // Argument validation + if (gettype($url) != 'string') + throw new CAS_TypeMismatchException($url, '$url', 'string'); if (gettype($serviceUrl) != 'string') - throw new CAS_TypeMismatchException($serviceUrl, '$serviceUrl', 'string'); + throw new CAS_TypeMismatchException($serviceUrl, '$serviceUrl', 'string'); if (gettype($flags) != 'integer') - throw new CAS_TypeMismatchException($flags, '$flags', 'string'); + throw new CAS_TypeMismatchException($flags, '$flags', 'string'); try { $service = $this->getProxiedService(PHPCAS_PROXIED_SERVICE_IMAP); @@ -3336,6 +3508,295 @@ class CAS_Client return $result; } + /** + * This method recursively parses the attribute XML. + * It also collapses name-value pairs into a single + * array entry. It parses all common formats of + * attributes and well formed XML files. + * + * @param string $root the DOM root element to be parsed + * @param string $namespace namespace of the elements + * + * @return an array of the parsed XML elements + * + * Formats tested: + * + * "Jasig Style" Attributes: + * + * + * + * jsmith + * + * RubyCAS + * Smith + * John + * CN=Staff,OU=Groups,DC=example,DC=edu + * CN=Spanish Department,OU=Departments,OU=Groups,DC=example,DC=edu + * + * PGTIOU-84678-8a9d2sfa23casd + * + * + * + * "Jasig Style" Attributes (longer version): + * + * + * + * jsmith + * + * + * surname + * Smith + * + * + * givenName + * John + * + * + * memberOf + * ['CN=Staff,OU=Groups,DC=example,DC=edu', 'CN=Spanish Department,OU=Departments,OU=Groups,DC=example,DC=edu'] + * + * + * PGTIOU-84678-8a9d2sfa23casd + * + * + * + * "RubyCAS Style" attributes + * + * + * + * jsmith + * + * RubyCAS + * Smith + * John + * CN=Staff,OU=Groups,DC=example,DC=edu + * CN=Spanish Department,OU=Departments,OU=Groups,DC=example,DC=edu + * + * PGTIOU-84678-8a9d2sfa23casd + * + * + * + * "Name-Value" attributes. + * + * Attribute format from these mailing list thread: + * http://jasig.275507.n4.nabble.com/CAS-attributes-and-how-they-appear-in-the-CAS-response-td264272.html + * Note: This is a less widely used format, but in use by at least two institutions. + * + * + * + * jsmith + * + * + * + * + * + * + * + * PGTIOU-84678-8a9d2sfa23casd + * + * + * + * result: + * + * Array ( + * [surname] => Smith + * [givenName] => John + * [memberOf] => Array ( + * [0] => CN=Staff, OU=Groups, DC=example, DC=edu + * [1] => CN=Spanish Department, OU=Departments, OU=Groups, DC=example, DC=edu + * ) + * ) + */ + private function _xml_to_array($root, $namespace = "cas") + { + $result = array(); + if ($root->hasAttributes()) { + $attrs = $root->attributes; + $pair = array(); + foreach ($attrs as $attr) { + if ($attr->name === "name") { + $pair['name'] = $attr->value; + } elseif ($attr->name === "value") { + $pair['value'] = $attr->value; + } else { + $result[$attr->name] = $attr->value; + } + if (array_key_exists('name', $pair) && array_key_exists('value', $pair)) { + $result[$pair['name']] = $pair['value']; + } + } + } + if ($root->hasChildNodes()) { + $children = $root->childNodes; + if ($children->length == 1) { + $child = $children->item(0); + if ($child->nodeType == XML_TEXT_NODE) { + $result['_value'] = $child->nodeValue; + return (count($result) == 1) ? $result['_value'] : $result; + } + } + $groups = array(); + foreach ($children as $child) { + $child_nodeName = str_ireplace($namespace . ":", "", $child->nodeName); + if (in_array($child_nodeName, array("user", "proxies", "proxyGrantingTicket"))) { + continue; + } + if (!isset($result[$child_nodeName])) { + $res = $this->_xml_to_array($child, $namespace); + if (!empty($res)) { + $result[$child_nodeName] = $this->_xml_to_array($child, $namespace); + } + } else { + if (!isset($groups[$child_nodeName])) { + $result[$child_nodeName] = array($result[$child_nodeName]); + $groups[$child_nodeName] = 1; + } + $result[$child_nodeName][] = $this->_xml_to_array($child, $namespace); + } + } + } + return $result; + } + + /** + * This method parses a "JSON-like array" of strings + * into an array of strings + * + * @param string $json_value the json-like string: + * e.g.: + * ['CN=Staff,OU=Groups,DC=example,DC=edu', 'CN=Spanish Department,OU=Departments,OU=Groups,DC=example,DC=edu'] + * + * @return array of strings Description + * e.g.: + * Array ( + * [0] => CN=Staff,OU=Groups,DC=example,DC=edu + * [1] => CN=Spanish Department,OU=Departments,OU=Groups,DC=example,DC=edu + * ) + */ + private function _parse_json_like_array_value($json_value) + { + $parts = explode(",", trim($json_value, "[]")); + $out = array(); + $quote = ''; + foreach ($parts as $part) { + $part = trim($part); + if ($quote === '') { + $value = ""; + if ($this->_startsWith($part, '\'')) { + $quote = '\''; + } elseif ($this->_startsWith($part, '"')) { + $quote = '"'; + } else { + $out[] = $part; + } + $part = ltrim($part, $quote); + } + if ($quote !== '') { + $value .= $part; + if ($this->_endsWith($part, $quote)) { + $out[] = rtrim($value, $quote); + $quote = ''; + } else { + $value .= ", "; + }; + } + } + return $out; + } + + /** + * This method recursively removes unneccessary hirarchy levels in array-trees. + * into an array of strings + * + * @param array $arr the array to flatten + * e.g.: + * Array ( + * [attributes] => Array ( + * [attribute] => Array ( + * [0] => Array ( + * [name] => surname + * [value] => Smith + * ) + * [1] => Array ( + * [name] => givenName + * [value] => John + * ) + * [2] => Array ( + * [name] => memberOf + * [value] => ['CN=Staff,OU=Groups,DC=example,DC=edu', 'CN=Spanish Department,OU=Departments,OU=Groups,DC=example,DC=edu'] + * ) + * ) + * ) + * ) + * + * @return array the flattened array + * e.g.: + * Array ( + * [attribute] => Array ( + * [surname] => Smith + * [givenName] => John + * [memberOf] => Array ( + * [0] => CN=Staff, OU=Groups, DC=example, DC=edu + * [1] => CN=Spanish Department, OU=Departments, OU=Groups, DC=example, DC=edu + * ) + * ) + * ) + */ + private function _flatten_array($arr) + { + if (!is_array($arr)) { + if ($this->_startsWith($arr, '[') && $this->_endsWith($arr, ']')) { + return $this->_parse_json_like_array_value($arr); + } else { + return $arr; + } + } + $out = array(); + foreach ($arr as $key => $val) { + if (!is_array($val)) { + $out[$key] = $val; + } else { + switch (count($val)) { + case 1 : { + $key = key($val); + if (array_key_exists($key, $out)) { + $value = $out[$key]; + if (!is_array($value)) { + $out[$key] = array(); + $out[$key][] = $value; + } + $out[$key][] = $this->_flatten_array($val[$key]); + } else { + $out[$key] = $this->_flatten_array($val[$key]); + }; + break; + }; + case 2 : { + if (array_key_exists("name", $val) && array_key_exists("value", $val)) { + $key = $val['name']; + if (array_key_exists($key, $out)) { + $value = $out[$key]; + if (!is_array($value)) { + $out[$key] = array(); + $out[$key][] = $value; + } + $out[$key][] = $this->_flatten_array($val['value']); + } else { + $out[$key] = $this->_flatten_array($val['value']); + }; + } else { + $out[$key] = $this->_flatten_array($val); + } + break; + }; + default: { + $out[$key] = $this->_flatten_array($val); + } + } + } + } + return $out; + } /** * This method will parse the DOM and pull out the attributes from the XML @@ -3351,23 +3812,6 @@ class CAS_Client phpCAS::traceBegin(); $extra_attributes = array(); - - // "Jasig Style" Attributes: - // - // - // - // jsmith - // - // RubyCAS - // Smith - // John - // CN=Staff,OU=Groups,DC=example,DC=edu - // CN=Spanish Department,OU=Departments,OU=Groups,DC=example,DC=edu - // - // PGTIOU-84678-8a9d2sfa23casd - // - // - // if ($this->_casAttributeParserCallbackFunction !== null && is_callable($this->_casAttributeParserCallbackFunction) ) { @@ -3377,111 +3821,19 @@ class CAS_Client $this->_casAttributeParserCallbackFunction, $this->_casAttributeParserCallbackArgs ); - } elseif ( $success_elements->item(0)->getElementsByTagName("attributes")->length != 0) { - $attr_nodes = $success_elements->item(0) - ->getElementsByTagName("attributes"); - phpCAS :: trace("Found nested jasig style attributes"); - if ($attr_nodes->item(0)->hasChildNodes()) { - // Nested Attributes - foreach ($attr_nodes->item(0)->childNodes as $attr_child) { - phpCAS :: trace( - "Attribute [".$attr_child->localName."] = " - .$attr_child->nodeValue - ); - $this->_addAttributeToArray( - $extra_attributes, $attr_child->localName, - $attr_child->nodeValue - ); - } - } } else { - // "RubyCAS Style" attributes - // - // - // - // jsmith - // - // RubyCAS - // Smith - // John - // CN=Staff,OU=Groups,DC=example,DC=edu - // CN=Spanish Department,OU=Departments,OU=Groups,DC=example,DC=edu - // - // PGTIOU-84678-8a9d2sfa23casd - // - // - // - phpCAS :: trace("Testing for rubycas style attributes"); - $childnodes = $success_elements->item(0)->childNodes; - foreach ($childnodes as $attr_node) { - switch ($attr_node->localName) { - case 'user': - case 'proxies': - case 'proxyGrantingTicket': - break; - default: - if (strlen(trim($attr_node->nodeValue))) { - phpCAS :: trace( - "Attribute [".$attr_node->localName."] = ".$attr_node->nodeValue - ); - $this->_addAttributeToArray( - $extra_attributes, $attr_node->localName, - $attr_node->nodeValue - ); - } - } - } + phpCAS :: trace("Parse extra attributes: "); + $attributes = $this->_xml_to_array($success_elements->item(0)); + phpCAS :: trace(print_r($attributes,true). "\nFLATTEN Array: "); + $extra_attributes = $this->_flatten_array($attributes); + phpCAS :: trace(print_r($extra_attributes, true)."\nFILTER : "); + if (array_key_exists("attribute", $extra_attributes)) { + $extra_attributes = $extra_attributes["attribute"]; + } elseif (array_key_exists("attributes", $extra_attributes)) { + $extra_attributes = $extra_attributes["attributes"]; + }; + phpCAS :: trace(print_r($extra_attributes, true)."return"); } - - // "Name-Value" attributes. - // - // Attribute format from these mailing list thread: - // http://jasig.275507.n4.nabble.com/CAS-attributes-and-how-they-appear-in-the-CAS-response-td264272.html - // Note: This is a less widely used format, but in use by at least two institutions. - // - // - // - // jsmith - // - // - // - // - // - // - // - // PGTIOU-84678-8a9d2sfa23casd - // - // - // - if (!count($extra_attributes) - && $success_elements->item(0)->getElementsByTagName("attribute")->length != 0 - ) { - $attr_nodes = $success_elements->item(0) - ->getElementsByTagName("attribute"); - $firstAttr = $attr_nodes->item(0); - if (!$firstAttr->hasChildNodes() - && $firstAttr->hasAttribute('name') - && $firstAttr->hasAttribute('value') - ) { - phpCAS :: trace("Found Name-Value style attributes"); - // Nested Attributes - foreach ($attr_nodes as $attr_node) { - if ($attr_node->hasAttribute('name') - && $attr_node->hasAttribute('value') - ) { - phpCAS :: trace( - "Attribute [".$attr_node->getAttribute('name') - ."] = ".$attr_node->getAttribute('value') - ); - $this->_addAttributeToArray( - $extra_attributes, $attr_node->getAttribute('name'), - $attr_node->getAttribute('value') - ); - } - } - } - } - $this->setAttributes($extra_attributes); phpCAS::traceEnd(); return true; @@ -3546,9 +3898,9 @@ class CAS_Client */ public function setURL($url) { - // Argument Validation - if (gettype($url) != 'string') - throw new CAS_TypeMismatchException($url, '$url', 'string'); + // Argument Validation + if (gettype($url) != 'string') + throw new CAS_TypeMismatchException($url, '$url', 'string'); $this->_url = $url; } @@ -3569,8 +3921,8 @@ class CAS_Client $final_uri .= '://'; $final_uri .= $this->_getClientUrl(); - $request_uri = explode('?', $_SERVER['REQUEST_URI'], 2); - $final_uri .= $request_uri[0]; + $request_uri = explode('?', $_SERVER['REQUEST_URI'], 2); + $final_uri .= $request_uri[0]; if (isset($request_uri[1]) && $request_uri[1]) { $query_string= $this->_removeParameterFromQueryString('ticket', $request_uri[1]); @@ -3578,7 +3930,7 @@ class CAS_Client // If the query string still has anything left, // append it to the final URI if ($query_string !== '') { - $final_uri .= "?$query_string"; + $final_uri .= "?$query_string"; } } @@ -3598,9 +3950,9 @@ class CAS_Client */ public function setBaseURL($url) { - // Argument Validation - if (gettype($url) != 'string') - throw new CAS_TypeMismatchException($url, '$url', 'string'); + // Argument Validation + if (gettype($url) != 'string') + throw new CAS_TypeMismatchException($url, '$url', 'string'); return $this->_server['base_url'] = $url; } @@ -3703,38 +4055,29 @@ class CAS_Client } /** - * Renaming the session + * This method tests if a string starts with a given character. * - * @param string $ticket name of the ticket + * @param string $text text to test + * @param string $char character to test for * - * @return void + * @return bool true if the $text starts with $char */ - private function _renameSession($ticket) + private function _startsWith($text, $char) { - phpCAS::traceBegin(); - if ($this->getChangeSessionID()) { - if (!empty($this->_user)) { - $old_session = $_SESSION; - phpCAS :: trace("Killing session: ". session_id()); - session_destroy(); - // set up a new session, of name based on the ticket - $session_id = $this->_sessionIdForTicket($ticket); - phpCAS :: trace("Starting session: ". $session_id); - session_id($session_id); - session_start(); - phpCAS :: trace("Restoring old session vars"); - $_SESSION = $old_session; - } else { - phpCAS :: trace ( - 'Session should only be renamed after successfull authentication' - ); - } - } else { - phpCAS :: trace( - "Skipping session rename since phpCAS is not handling the session." - ); - } - phpCAS::traceEnd(); + return (strpos($text, $char) === 0); + } + + /** + * This method tests if a string ends with a given character + * + * @param string $text text to test + * @param string $char character to test for + * + * @return bool true if the $text ends with $char + */ + private function _endsWith($text, $char) + { + return (strpos(strrev($text), $char) === 0); } /** @@ -3885,9 +4228,9 @@ class CAS_Client */ public function addRebroadcastNode($rebroadcastNodeUrl) { - // Argument validation - if ( !(bool)preg_match("/^(http|https):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i", $rebroadcastNodeUrl)) - throw new CAS_TypeMismatchException($rebroadcastNodeUrl, '$rebroadcastNodeUrl', 'url'); + // Argument validation + if ( !(bool)preg_match("/^(http|https):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i", $rebroadcastNodeUrl)) + throw new CAS_TypeMismatchException($rebroadcastNodeUrl, '$rebroadcastNodeUrl', 'url'); // Store the rebroadcast node and set flag $this->_rebroadcast = true; @@ -3909,8 +4252,8 @@ class CAS_Client */ public function addRebroadcastHeader($header) { - if (gettype($header) != 'string') - throw new CAS_TypeMismatchException($header, '$header', 'string'); + if (gettype($header) != 'string') + throw new CAS_TypeMismatchException($header, '$header', 'string'); $this->_rebroadcast_headers[] = $header; } diff --git a/auth/cas/CAS/CAS/CookieJar.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/CookieJar.php similarity index 99% rename from auth/cas/CAS/CAS/CookieJar.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/CookieJar.php index 38f849dfe82..760794f41bc 100644 --- a/auth/cas/CAS/CAS/CookieJar.php +++ b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/CookieJar.php @@ -231,6 +231,7 @@ class CAS_CookieJar case 'commenturl': case 'discard': case 'httponly': + case 'samesite': $cookie[$attributeNameLC] = $attributeValue; break; default: diff --git a/auth/cas/CAS/CAS/Exception.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Exception.php similarity index 100% rename from auth/cas/CAS/CAS/Exception.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Exception.php diff --git a/auth/cas/CAS/CAS/GracefullTerminationException.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/GracefullTerminationException.php similarity index 100% rename from auth/cas/CAS/CAS/GracefullTerminationException.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/GracefullTerminationException.php diff --git a/auth/cas/CAS/CAS/InvalidArgumentException.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/InvalidArgumentException.php similarity index 100% rename from auth/cas/CAS/CAS/InvalidArgumentException.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/InvalidArgumentException.php diff --git a/auth/cas/CAS/CAS/Languages/Catalan.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/Catalan.php similarity index 100% rename from auth/cas/CAS/CAS/Languages/Catalan.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/Catalan.php diff --git a/auth/cas/CAS/CAS/Languages/ChineseSimplified.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/ChineseSimplified.php similarity index 100% rename from auth/cas/CAS/CAS/Languages/ChineseSimplified.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/ChineseSimplified.php diff --git a/auth/cas/CAS/CAS/Languages/English.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/English.php similarity index 100% rename from auth/cas/CAS/CAS/Languages/English.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/English.php diff --git a/auth/cas/CAS/CAS/Languages/French.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/French.php similarity index 100% rename from auth/cas/CAS/CAS/Languages/French.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/French.php diff --git a/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/Galego.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/Galego.php new file mode 100644 index 00000000000..7d1b7dbd204 --- /dev/null +++ b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/Galego.php @@ -0,0 +1,117 @@ +aquí para continuar'; + } + + /** + * Get authentication failed string + * + * @return string authentication failed + */ + public function getAuthenticationFailed() + { + return 'Autenticación CAS errada!'; + } + + /** + * Get the your were not authenticated string + * + * @return string not authenticated + */ + public function getYouWereNotAuthenticated() + { + return ' +

Non estás autenticado

Podes volver tentalo facendo click aquí.

Se o problema persiste debería contactar con el administrador deste sitio.

'; + } + + /** + * Get the service unavailable string + * + * @return string service unavailable + */ + public function getServiceUnavailable() + { + return 'O servizo `%s\' non está dispoñible (%s).'; + } +} +?> diff --git a/auth/cas/CAS/CAS/Languages/German.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/German.php similarity index 100% rename from auth/cas/CAS/CAS/Languages/German.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/German.php diff --git a/auth/cas/CAS/CAS/Languages/Greek.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/Greek.php similarity index 100% rename from auth/cas/CAS/CAS/Languages/Greek.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/Greek.php diff --git a/auth/cas/CAS/CAS/Languages/Japanese.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/Japanese.php similarity index 100% rename from auth/cas/CAS/CAS/Languages/Japanese.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/Japanese.php diff --git a/auth/cas/CAS/CAS/Languages/LanguageInterface.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/LanguageInterface.php similarity index 100% rename from auth/cas/CAS/CAS/Languages/LanguageInterface.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/LanguageInterface.php diff --git a/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/Portuguese.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/Portuguese.php new file mode 100644 index 00000000000..c3869ef08b5 --- /dev/null +++ b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/Portuguese.php @@ -0,0 +1,114 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://apereo.atlassian.net/wiki/spaces/CASC/pages/103252517/phpCAS + */ + +/** + * Portuguese language class + * + * @class CAS_Languages_Portuguese + * @category Authentication + * @package PhpCAS + * @author Sherwin Harris + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://apereo.atlassian.net/wiki/spaces/CASC/pages/103252517/phpCAS + * + * @sa @link internalLang Internationalization @endlink + * @ingroup internalLang + */ +class CAS_Languages_Portuguese implements CAS_Languages_LanguageInterface +{ + /** + * Get the using server string + * + * @return string using server + */ + public function getUsingServer() + { + return 'Usando o servidor'; + } + + /** + * Get authentication wanted string + * + * @return string authentication wanted + */ + public function getAuthenticationWanted() + { + return 'A autenticação do servidor CAS desejado!'; + } + + /** + * Get logout string + * + * @return string logout + */ + public function getLogout() + { + return 'Saida do servidor CAS desejado!'; + } + + /** + * Get the should have been redirected string + * + * @return string should have been redirected + */ + public function getShouldHaveBeenRedirected() + { + return 'Você já deve ter sido redirecionado para o servidor CAS. Clique aqui para continuar'; + } + + /** + * Get authentication failed string + * + * @return string authentication failed + */ + public function getAuthenticationFailed() + { + return 'A autenticação do servidor CAS falheu!'; + } + + /** + * Get the your were not authenticated string + * + * @return string not authenticated + */ + public function getYouWereNotAuthenticated() + { + return '

Você não foi autenticado.

Você pode enviar sua solicitação novamente clicando aqui.

Se o problema persistir, você pode entrar em contato com o administrador deste site.

'; + } + + /** + * Get the service unavailable string + * + * @return string service unavailable + */ + public function getServiceUnavailable() + { + return 'O serviço `%s\' não está disponível (%s).'; + } +} diff --git a/auth/cas/CAS/CAS/Languages/Spanish.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/Spanish.php similarity index 100% rename from auth/cas/CAS/CAS/Languages/Spanish.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Languages/Spanish.php diff --git a/auth/cas/CAS/CAS/OutOfSequenceBeforeAuthenticationCallException.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeAuthenticationCallException.php similarity index 100% rename from auth/cas/CAS/CAS/OutOfSequenceBeforeAuthenticationCallException.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeAuthenticationCallException.php diff --git a/auth/cas/CAS/CAS/OutOfSequenceBeforeClientException.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeClientException.php similarity index 100% rename from auth/cas/CAS/CAS/OutOfSequenceBeforeClientException.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeClientException.php diff --git a/auth/cas/CAS/CAS/OutOfSequenceBeforeProxyException.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeProxyException.php similarity index 100% rename from auth/cas/CAS/CAS/OutOfSequenceBeforeProxyException.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeProxyException.php diff --git a/auth/cas/CAS/CAS/OutOfSequenceException.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/OutOfSequenceException.php similarity index 100% rename from auth/cas/CAS/CAS/OutOfSequenceException.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/OutOfSequenceException.php diff --git a/auth/cas/CAS/CAS/PGTStorage/AbstractStorage.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/PGTStorage/AbstractStorage.php similarity index 100% rename from auth/cas/CAS/CAS/PGTStorage/AbstractStorage.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/PGTStorage/AbstractStorage.php diff --git a/auth/cas/CAS/CAS/PGTStorage/Db.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/PGTStorage/Db.php similarity index 100% rename from auth/cas/CAS/CAS/PGTStorage/Db.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/PGTStorage/Db.php diff --git a/auth/cas/CAS/CAS/PGTStorage/File.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/PGTStorage/File.php similarity index 100% rename from auth/cas/CAS/CAS/PGTStorage/File.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/PGTStorage/File.php diff --git a/auth/cas/CAS/CAS/ProxiedService.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService.php similarity index 100% rename from auth/cas/CAS/CAS/ProxiedService.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService.php diff --git a/auth/cas/CAS/CAS/ProxiedService/Abstract.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService/Abstract.php similarity index 100% rename from auth/cas/CAS/CAS/ProxiedService/Abstract.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService/Abstract.php diff --git a/auth/cas/CAS/CAS/ProxiedService/Exception.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService/Exception.php similarity index 100% rename from auth/cas/CAS/CAS/ProxiedService/Exception.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService/Exception.php diff --git a/auth/cas/CAS/CAS/ProxiedService/Http.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService/Http.php similarity index 100% rename from auth/cas/CAS/CAS/ProxiedService/Http.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService/Http.php diff --git a/auth/cas/CAS/CAS/ProxiedService/Http/Abstract.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Abstract.php similarity index 100% rename from auth/cas/CAS/CAS/ProxiedService/Http/Abstract.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Abstract.php diff --git a/auth/cas/CAS/CAS/ProxiedService/Http/Get.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Get.php similarity index 100% rename from auth/cas/CAS/CAS/ProxiedService/Http/Get.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Get.php diff --git a/auth/cas/CAS/CAS/ProxiedService/Http/Post.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Post.php similarity index 100% rename from auth/cas/CAS/CAS/ProxiedService/Http/Post.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Post.php diff --git a/auth/cas/CAS/CAS/ProxiedService/Imap.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService/Imap.php similarity index 100% rename from auth/cas/CAS/CAS/ProxiedService/Imap.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService/Imap.php diff --git a/auth/cas/CAS/CAS/ProxiedService/Testable.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService/Testable.php similarity index 100% rename from auth/cas/CAS/CAS/ProxiedService/Testable.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxiedService/Testable.php diff --git a/auth/cas/CAS/CAS/ProxyChain.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxyChain.php similarity index 100% rename from auth/cas/CAS/CAS/ProxyChain.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxyChain.php diff --git a/auth/cas/CAS/CAS/ProxyChain/AllowedList.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxyChain/AllowedList.php similarity index 100% rename from auth/cas/CAS/CAS/ProxyChain/AllowedList.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxyChain/AllowedList.php diff --git a/auth/cas/CAS/CAS/ProxyChain/Any.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxyChain/Any.php similarity index 100% rename from auth/cas/CAS/CAS/ProxyChain/Any.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxyChain/Any.php diff --git a/auth/cas/CAS/CAS/ProxyChain/Interface.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxyChain/Interface.php similarity index 100% rename from auth/cas/CAS/CAS/ProxyChain/Interface.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxyChain/Interface.php diff --git a/auth/cas/CAS/CAS/ProxyChain/Trusted.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxyChain/Trusted.php similarity index 100% rename from auth/cas/CAS/CAS/ProxyChain/Trusted.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxyChain/Trusted.php diff --git a/auth/cas/CAS/CAS/ProxyTicketException.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxyTicketException.php similarity index 100% rename from auth/cas/CAS/CAS/ProxyTicketException.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ProxyTicketException.php diff --git a/auth/cas/CAS/CAS/Request/AbstractRequest.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Request/AbstractRequest.php similarity index 100% rename from auth/cas/CAS/CAS/Request/AbstractRequest.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Request/AbstractRequest.php diff --git a/auth/cas/CAS/CAS/Request/CurlMultiRequest.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Request/CurlMultiRequest.php similarity index 100% rename from auth/cas/CAS/CAS/Request/CurlMultiRequest.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Request/CurlMultiRequest.php diff --git a/auth/cas/CAS/CAS/Request/CurlRequest.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Request/CurlRequest.php similarity index 98% rename from auth/cas/CAS/CAS/Request/CurlRequest.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Request/CurlRequest.php index 70057712ed3..c8b0933d00d 100644 --- a/auth/cas/CAS/CAS/Request/CurlRequest.php +++ b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Request/CurlRequest.php @@ -179,7 +179,7 @@ implements CAS_Request_RequestInterface * * @return void */ - private function _storeResponseBody ($body) + public function _storeResponseBody ($body) { $this->storeResponseBody($body); } @@ -192,7 +192,7 @@ implements CAS_Request_RequestInterface * * @return int */ - private function _curlReadHeaders ($ch, $header) + public function _curlReadHeaders ($ch, $header) { $this->storeResponseHeader($header); return strlen($header); diff --git a/auth/cas/CAS/CAS/Request/Exception.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Request/Exception.php similarity index 100% rename from auth/cas/CAS/CAS/Request/Exception.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Request/Exception.php diff --git a/auth/cas/CAS/CAS/Request/MultiRequestInterface.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Request/MultiRequestInterface.php similarity index 100% rename from auth/cas/CAS/CAS/Request/MultiRequestInterface.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Request/MultiRequestInterface.php diff --git a/auth/cas/CAS/CAS/Request/RequestInterface.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Request/RequestInterface.php similarity index 100% rename from auth/cas/CAS/CAS/Request/RequestInterface.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Request/RequestInterface.php diff --git a/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Session/PhpSession.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Session/PhpSession.php new file mode 100644 index 00000000000..afbd5e2935a --- /dev/null +++ b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/Session/PhpSession.php @@ -0,0 +1,45 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ + +/** + * Empty class used as a default implementation for phpCAS. + * + * Implements the standard PHP session handler without no alterations. + * + * @class CAS_Session_PhpSession + * @category Authentication + * @package PhpCAS + * @author Adam Franco + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ +class CAS_Session_PhpSession extends SessionHandler implements SessionHandlerInterface +{ +} diff --git a/auth/cas/CAS/CAS/TypeMismatchException.php b/auth/cas/CAS/vendor/apereo/phpcas/source/CAS/TypeMismatchException.php similarity index 100% rename from auth/cas/CAS/CAS/TypeMismatchException.php rename to auth/cas/CAS/vendor/apereo/phpcas/source/CAS/TypeMismatchException.php diff --git a/auth/cas/CAS/vendor/autoload.php b/auth/cas/CAS/vendor/autoload.php new file mode 100644 index 00000000000..2840ee31c2f --- /dev/null +++ b/auth/cas/CAS/vendor/autoload.php @@ -0,0 +1,7 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + /** @var ?string */ + private $vendorDir; + + // PSR-4 + /** + * @var array[] + * @psalm-var array> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array[] + * @psalm-var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var array[] + * @psalm-var array + */ + private $fallbackDirsPsr4 = array(); + + // PSR-0 + /** + * @var array[] + * @psalm-var array> + */ + private $prefixesPsr0 = array(); + /** + * @var array[] + * @psalm-var array + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var string[] + * @psalm-var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var bool[] + * @psalm-var array + */ + private $missingClasses = array(); + + /** @var ?string */ + private $apcuPrefix; + + /** + * @var self[] + */ + private static $registeredLoaders = array(); + + /** + * @param ?string $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + } + + /** + * @return string[] + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array[] + * @psalm-return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return array[] + * @psalm-return array + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return array[] + * @psalm-return array + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return string[] Array of classname => path + * @psalm-return array + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param string[] $classMap Class to filename map + * @psalm-param array $classMap + * + * @return void + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 base directories + * + * @return void + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + * + * @return void + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + * + * @return void + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + * + * @return void + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } + } + + /** + * Unregisters this instance as an autoloader. + * + * @return void + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return true|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + + return null; + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + /** + * Returns the currently registered loaders indexed by their corresponding vendor directories. + * + * @return self[] + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + * @private + */ +function includeFile($file) +{ + include $file; +} diff --git a/auth/cas/CAS/vendor/composer/InstalledVersions.php b/auth/cas/CAS/vendor/composer/InstalledVersions.php new file mode 100644 index 00000000000..d50e0c9fcc4 --- /dev/null +++ b/auth/cas/CAS/vendor/composer/InstalledVersions.php @@ -0,0 +1,350 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer; + +use Composer\Autoload\ClassLoader; +use Composer\Semver\VersionParser; + +/** + * This class is copied in every Composer installed project and available to all + * + * See also https://getcomposer.org/doc/07-runtime.md#installed-versions + * + * To require its presence, you can require `composer-runtime-api ^2.0` + */ +class InstalledVersions +{ + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array}|array{}|null + */ + private static $installed; + + /** + * @var bool|null + */ + private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ + private static $installedByVendor = array(); + + /** + * Returns a list of all package names which are present, either by being installed, replaced or provided + * + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackages() + { + $packages = array(); + foreach (self::getInstalled() as $installed) { + $packages[] = array_keys($installed['versions']); + } + + if (1 === \count($packages)) { + return $packages[0]; + } + + return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); + } + + /** + * Returns a list of all package names with a specific type e.g. 'library' + * + * @param string $type + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackagesByType($type) + { + $packagesByType = array(); + + foreach (self::getInstalled() as $installed) { + foreach ($installed['versions'] as $name => $package) { + if (isset($package['type']) && $package['type'] === $type) { + $packagesByType[] = $name; + } + } + } + + return $packagesByType; + } + + /** + * Checks whether the given package is installed + * + * This also returns true if the package name is provided or replaced by another package + * + * @param string $packageName + * @param bool $includeDevRequirements + * @return bool + */ + public static function isInstalled($packageName, $includeDevRequirements = true) + { + foreach (self::getInstalled() as $installed) { + if (isset($installed['versions'][$packageName])) { + return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); + } + } + + return false; + } + + /** + * Checks whether the given package satisfies a version constraint + * + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: + * + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') + * + * @param VersionParser $parser Install composer/semver to have access to this class and functionality + * @param string $packageName + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package + * @return bool + */ + public static function satisfies(VersionParser $parser, $packageName, $constraint) + { + $constraint = $parser->parseConstraints($constraint); + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + + return $provided->matches($constraint); + } + + /** + * Returns a version constraint representing all the range(s) which are installed for a given package + * + * It is easier to use this via isInstalled() with the $constraint argument if you need to check + * whether a given version of a package is installed, and not just whether it exists + * + * @param string $packageName + * @return string Version constraint usable with composer/semver + */ + public static function getVersionRanges($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + $ranges = array(); + if (isset($installed['versions'][$packageName]['pretty_version'])) { + $ranges[] = $installed['versions'][$packageName]['pretty_version']; + } + if (array_key_exists('aliases', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); + } + if (array_key_exists('replaced', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); + } + if (array_key_exists('provided', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); + } + + return implode(' || ', $ranges); + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['version'])) { + return null; + } + + return $installed['versions'][$packageName]['version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getPrettyVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['pretty_version'])) { + return null; + } + + return $installed['versions'][$packageName]['pretty_version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference + */ + public static function getReference($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['reference'])) { + return null; + } + + return $installed['versions'][$packageName]['reference']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. + */ + public static function getInstallPath($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @return array + * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} + */ + public static function getRootPackage() + { + $installed = self::getInstalled(); + + return $installed[0]['root']; + } + + /** + * Returns the raw installed.php data for custom implementations + * + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. + * @return array[] + * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array} + */ + public static function getRawData() + { + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = include __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + + return self::$installed; + } + + /** + * Returns the raw data of all installed.php which are currently loaded for custom implementations + * + * @return array[] + * @psalm-return list}> + */ + public static function getAllRawData() + { + return self::getInstalled(); + } + + /** + * Lets you reload the static array from another file + * + * This is only useful for complex integrations in which a project needs to use + * this class but then also needs to execute another project's autoloader in process, + * and wants to ensure both projects have access to their version of installed.php. + * + * A typical case would be PHPUnit, where it would need to make sure it reads all + * the data it needs from this class, then call reload() with + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure + * the project in which it runs can then also use this class safely, without + * interference between PHPUnit's dependencies and the project's dependencies. + * + * @param array[] $data A vendor/composer/installed.php data set + * @return void + * + * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array} $data + */ + public static function reload($data) + { + self::$installed = $data; + self::$installedByVendor = array(); + } + + /** + * @return array[] + * @psalm-return list}> + */ + private static function getInstalled() + { + if (null === self::$canGetVendors) { + self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); + } + + $installed = array(); + + if (self::$canGetVendors) { + foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + if (isset(self::$installedByVendor[$vendorDir])) { + $installed[] = self::$installedByVendor[$vendorDir]; + } elseif (is_file($vendorDir.'/composer/installed.php')) { + $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; + if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { + self::$installed = $installed[count($installed) - 1]; + } + } + } + } + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = require __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + $installed[] = self::$installed; + + return $installed; + } +} diff --git a/auth/cas/CAS/vendor/composer/LICENSE b/auth/cas/CAS/vendor/composer/LICENSE new file mode 100644 index 00000000000..f27399a042d --- /dev/null +++ b/auth/cas/CAS/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/auth/cas/CAS/vendor/composer/autoload_classmap.php b/auth/cas/CAS/vendor/composer/autoload_classmap.php new file mode 100644 index 00000000000..a3b0345febc --- /dev/null +++ b/auth/cas/CAS/vendor/composer/autoload_classmap.php @@ -0,0 +1,58 @@ + $vendorDir . '/apereo/phpcas/source/CAS/AuthenticationException.php', + 'CAS_Client' => $vendorDir . '/apereo/phpcas/source/CAS/Client.php', + 'CAS_CookieJar' => $vendorDir . '/apereo/phpcas/source/CAS/CookieJar.php', + 'CAS_Exception' => $vendorDir . '/apereo/phpcas/source/CAS/Exception.php', + 'CAS_GracefullTerminationException' => $vendorDir . '/apereo/phpcas/source/CAS/GracefullTerminationException.php', + 'CAS_InvalidArgumentException' => $vendorDir . '/apereo/phpcas/source/CAS/InvalidArgumentException.php', + 'CAS_Languages_Catalan' => $vendorDir . '/apereo/phpcas/source/CAS/Languages/Catalan.php', + 'CAS_Languages_ChineseSimplified' => $vendorDir . '/apereo/phpcas/source/CAS/Languages/ChineseSimplified.php', + 'CAS_Languages_English' => $vendorDir . '/apereo/phpcas/source/CAS/Languages/English.php', + 'CAS_Languages_French' => $vendorDir . '/apereo/phpcas/source/CAS/Languages/French.php', + 'CAS_Languages_Galego' => $vendorDir . '/apereo/phpcas/source/CAS/Languages/Galego.php', + 'CAS_Languages_German' => $vendorDir . '/apereo/phpcas/source/CAS/Languages/German.php', + 'CAS_Languages_Greek' => $vendorDir . '/apereo/phpcas/source/CAS/Languages/Greek.php', + 'CAS_Languages_Japanese' => $vendorDir . '/apereo/phpcas/source/CAS/Languages/Japanese.php', + 'CAS_Languages_LanguageInterface' => $vendorDir . '/apereo/phpcas/source/CAS/Languages/LanguageInterface.php', + 'CAS_Languages_Portuguese' => $vendorDir . '/apereo/phpcas/source/CAS/Languages/Portuguese.php', + 'CAS_Languages_Spanish' => $vendorDir . '/apereo/phpcas/source/CAS/Languages/Spanish.php', + 'CAS_OutOfSequenceBeforeAuthenticationCallException' => $vendorDir . '/apereo/phpcas/source/CAS/OutOfSequenceBeforeAuthenticationCallException.php', + 'CAS_OutOfSequenceBeforeClientException' => $vendorDir . '/apereo/phpcas/source/CAS/OutOfSequenceBeforeClientException.php', + 'CAS_OutOfSequenceBeforeProxyException' => $vendorDir . '/apereo/phpcas/source/CAS/OutOfSequenceBeforeProxyException.php', + 'CAS_OutOfSequenceException' => $vendorDir . '/apereo/phpcas/source/CAS/OutOfSequenceException.php', + 'CAS_PGTStorage_AbstractStorage' => $vendorDir . '/apereo/phpcas/source/CAS/PGTStorage/AbstractStorage.php', + 'CAS_PGTStorage_Db' => $vendorDir . '/apereo/phpcas/source/CAS/PGTStorage/Db.php', + 'CAS_PGTStorage_File' => $vendorDir . '/apereo/phpcas/source/CAS/PGTStorage/File.php', + 'CAS_ProxiedService' => $vendorDir . '/apereo/phpcas/source/CAS/ProxiedService.php', + 'CAS_ProxiedService_Abstract' => $vendorDir . '/apereo/phpcas/source/CAS/ProxiedService/Abstract.php', + 'CAS_ProxiedService_Exception' => $vendorDir . '/apereo/phpcas/source/CAS/ProxiedService/Exception.php', + 'CAS_ProxiedService_Http' => $vendorDir . '/apereo/phpcas/source/CAS/ProxiedService/Http.php', + 'CAS_ProxiedService_Http_Abstract' => $vendorDir . '/apereo/phpcas/source/CAS/ProxiedService/Http/Abstract.php', + 'CAS_ProxiedService_Http_Get' => $vendorDir . '/apereo/phpcas/source/CAS/ProxiedService/Http/Get.php', + 'CAS_ProxiedService_Http_Post' => $vendorDir . '/apereo/phpcas/source/CAS/ProxiedService/Http/Post.php', + 'CAS_ProxiedService_Imap' => $vendorDir . '/apereo/phpcas/source/CAS/ProxiedService/Imap.php', + 'CAS_ProxiedService_Testable' => $vendorDir . '/apereo/phpcas/source/CAS/ProxiedService/Testable.php', + 'CAS_ProxyChain' => $vendorDir . '/apereo/phpcas/source/CAS/ProxyChain.php', + 'CAS_ProxyChain_AllowedList' => $vendorDir . '/apereo/phpcas/source/CAS/ProxyChain/AllowedList.php', + 'CAS_ProxyChain_Any' => $vendorDir . '/apereo/phpcas/source/CAS/ProxyChain/Any.php', + 'CAS_ProxyChain_Interface' => $vendorDir . '/apereo/phpcas/source/CAS/ProxyChain/Interface.php', + 'CAS_ProxyChain_Trusted' => $vendorDir . '/apereo/phpcas/source/CAS/ProxyChain/Trusted.php', + 'CAS_ProxyTicketException' => $vendorDir . '/apereo/phpcas/source/CAS/ProxyTicketException.php', + 'CAS_Request_AbstractRequest' => $vendorDir . '/apereo/phpcas/source/CAS/Request/AbstractRequest.php', + 'CAS_Request_CurlMultiRequest' => $vendorDir . '/apereo/phpcas/source/CAS/Request/CurlMultiRequest.php', + 'CAS_Request_CurlRequest' => $vendorDir . '/apereo/phpcas/source/CAS/Request/CurlRequest.php', + 'CAS_Request_Exception' => $vendorDir . '/apereo/phpcas/source/CAS/Request/Exception.php', + 'CAS_Request_MultiRequestInterface' => $vendorDir . '/apereo/phpcas/source/CAS/Request/MultiRequestInterface.php', + 'CAS_Request_RequestInterface' => $vendorDir . '/apereo/phpcas/source/CAS/Request/RequestInterface.php', + 'CAS_Session_PhpSession' => $vendorDir . '/apereo/phpcas/source/CAS/Session/PhpSession.php', + 'CAS_TypeMismatchException' => $vendorDir . '/apereo/phpcas/source/CAS/TypeMismatchException.php', + 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', + 'phpCAS' => $vendorDir . '/apereo/phpcas/source/CAS.php', +); diff --git a/auth/cas/CAS/vendor/composer/autoload_namespaces.php b/auth/cas/CAS/vendor/composer/autoload_namespaces.php new file mode 100644 index 00000000000..b7fc0125dbc --- /dev/null +++ b/auth/cas/CAS/vendor/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ + array($vendorDir . '/psr/log/Psr/Log'), +); diff --git a/auth/cas/CAS/vendor/composer/autoload_real.php b/auth/cas/CAS/vendor/composer/autoload_real.php new file mode 100644 index 00000000000..4823b938a7f --- /dev/null +++ b/auth/cas/CAS/vendor/composer/autoload_real.php @@ -0,0 +1,57 @@ += 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInitad79bd4bf22603c3738880e9bc6fc25d::getInitializer($loader)); + } else { + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } + + $loader->register(true); + + return $loader; + } +} diff --git a/auth/cas/CAS/vendor/composer/autoload_static.php b/auth/cas/CAS/vendor/composer/autoload_static.php new file mode 100644 index 00000000000..60efa4a209d --- /dev/null +++ b/auth/cas/CAS/vendor/composer/autoload_static.php @@ -0,0 +1,84 @@ + + array ( + 'Psr\\Log\\' => 8, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'Psr\\Log\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', + ), + ); + + public static $classMap = array ( + 'CAS_AuthenticationException' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/AuthenticationException.php', + 'CAS_Client' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Client.php', + 'CAS_CookieJar' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/CookieJar.php', + 'CAS_Exception' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Exception.php', + 'CAS_GracefullTerminationException' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/GracefullTerminationException.php', + 'CAS_InvalidArgumentException' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/InvalidArgumentException.php', + 'CAS_Languages_Catalan' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Languages/Catalan.php', + 'CAS_Languages_ChineseSimplified' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Languages/ChineseSimplified.php', + 'CAS_Languages_English' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Languages/English.php', + 'CAS_Languages_French' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Languages/French.php', + 'CAS_Languages_Galego' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Languages/Galego.php', + 'CAS_Languages_German' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Languages/German.php', + 'CAS_Languages_Greek' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Languages/Greek.php', + 'CAS_Languages_Japanese' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Languages/Japanese.php', + 'CAS_Languages_LanguageInterface' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Languages/LanguageInterface.php', + 'CAS_Languages_Portuguese' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Languages/Portuguese.php', + 'CAS_Languages_Spanish' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Languages/Spanish.php', + 'CAS_OutOfSequenceBeforeAuthenticationCallException' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/OutOfSequenceBeforeAuthenticationCallException.php', + 'CAS_OutOfSequenceBeforeClientException' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/OutOfSequenceBeforeClientException.php', + 'CAS_OutOfSequenceBeforeProxyException' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/OutOfSequenceBeforeProxyException.php', + 'CAS_OutOfSequenceException' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/OutOfSequenceException.php', + 'CAS_PGTStorage_AbstractStorage' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/PGTStorage/AbstractStorage.php', + 'CAS_PGTStorage_Db' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/PGTStorage/Db.php', + 'CAS_PGTStorage_File' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/PGTStorage/File.php', + 'CAS_ProxiedService' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ProxiedService.php', + 'CAS_ProxiedService_Abstract' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ProxiedService/Abstract.php', + 'CAS_ProxiedService_Exception' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ProxiedService/Exception.php', + 'CAS_ProxiedService_Http' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ProxiedService/Http.php', + 'CAS_ProxiedService_Http_Abstract' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ProxiedService/Http/Abstract.php', + 'CAS_ProxiedService_Http_Get' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ProxiedService/Http/Get.php', + 'CAS_ProxiedService_Http_Post' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ProxiedService/Http/Post.php', + 'CAS_ProxiedService_Imap' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ProxiedService/Imap.php', + 'CAS_ProxiedService_Testable' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ProxiedService/Testable.php', + 'CAS_ProxyChain' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ProxyChain.php', + 'CAS_ProxyChain_AllowedList' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ProxyChain/AllowedList.php', + 'CAS_ProxyChain_Any' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ProxyChain/Any.php', + 'CAS_ProxyChain_Interface' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ProxyChain/Interface.php', + 'CAS_ProxyChain_Trusted' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ProxyChain/Trusted.php', + 'CAS_ProxyTicketException' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ProxyTicketException.php', + 'CAS_Request_AbstractRequest' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Request/AbstractRequest.php', + 'CAS_Request_CurlMultiRequest' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Request/CurlMultiRequest.php', + 'CAS_Request_CurlRequest' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Request/CurlRequest.php', + 'CAS_Request_Exception' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Request/Exception.php', + 'CAS_Request_MultiRequestInterface' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Request/MultiRequestInterface.php', + 'CAS_Request_RequestInterface' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Request/RequestInterface.php', + 'CAS_Session_PhpSession' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Session/PhpSession.php', + 'CAS_TypeMismatchException' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/TypeMismatchException.php', + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + 'phpCAS' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInitad79bd4bf22603c3738880e9bc6fc25d::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitad79bd4bf22603c3738880e9bc6fc25d::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitad79bd4bf22603c3738880e9bc6fc25d::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/auth/cas/CAS/vendor/composer/installed.json b/auth/cas/CAS/vendor/composer/installed.json new file mode 100644 index 00000000000..de2b046898b --- /dev/null +++ b/auth/cas/CAS/vendor/composer/installed.json @@ -0,0 +1,128 @@ +{ + "packages": [ + { + "name": "apereo/phpcas", + "version": "1.4.0", + "version_normalized": "1.4.0.0", + "source": { + "type": "git", + "url": "https://github.com/apereo/phpCAS.git", + "reference": "ea27d122c4c7114006b33d15668c90f1904d53df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/apereo/phpCAS/zipball/ea27d122c4c7114006b33d15668c90f1904d53df", + "reference": "ea27d122c4c7114006b33d15668c90f1904d53df", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": ">=7.0.0", + "psr/log": "^1.0.0" + }, + "require-dev": { + "monolog/monolog": "^1.0.0", + "phpunit/phpunit": ">=4.8.35 <8" + }, + "time": "2021-05-30T19:53:34+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "source/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Joachim Fritschi", + "email": "jfritschi@freenet.de", + "homepage": "https://github.com/jfritschi" + }, + { + "name": "Adam Franco", + "homepage": "https://github.com/adamfranco" + }, + { + "name": "Henry Pan", + "homepage": "https://github.com/phy25" + } + ], + "description": "Provides a simple API for authenticating users against a CAS server", + "homepage": "https://wiki.jasig.org/display/CASC/phpCAS", + "keywords": [ + "apereo", + "cas", + "jasig" + ], + "support": { + "issues": "https://github.com/apereo/phpCAS/issues", + "source": "https://github.com/apereo/phpCAS/tree/1.4.0" + }, + "install-path": "../apereo/phpcas" + }, + { + "name": "psr/log", + "version": "1.1.4", + "version_normalized": "1.1.4.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2021-05-03T11:20:27+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "install-path": "../psr/log" + } + ], + "dev": true, + "dev-package-names": [] +} diff --git a/auth/cas/CAS/vendor/composer/installed.php b/auth/cas/CAS/vendor/composer/installed.php new file mode 100644 index 00000000000..3df1ec71635 --- /dev/null +++ b/auth/cas/CAS/vendor/composer/installed.php @@ -0,0 +1,41 @@ + array( + 'pretty_version' => '1.0.0+no-version-set', + 'version' => '1.0.0.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'reference' => NULL, + 'name' => '__root__', + 'dev' => true, + ), + 'versions' => array( + '__root__' => array( + 'pretty_version' => '1.0.0+no-version-set', + 'version' => '1.0.0.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'reference' => NULL, + 'dev_requirement' => false, + ), + 'apereo/phpcas' => array( + 'pretty_version' => '1.4.0', + 'version' => '1.4.0.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../apereo/phpcas', + 'aliases' => array(), + 'reference' => 'ea27d122c4c7114006b33d15668c90f1904d53df', + 'dev_requirement' => false, + ), + 'psr/log' => array( + 'pretty_version' => '1.1.4', + 'version' => '1.1.4.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/log', + 'aliases' => array(), + 'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11', + 'dev_requirement' => false, + ), + ), +); diff --git a/auth/cas/CAS/vendor/composer/platform_check.php b/auth/cas/CAS/vendor/composer/platform_check.php new file mode 100644 index 00000000000..f79e574be7b --- /dev/null +++ b/auth/cas/CAS/vendor/composer/platform_check.php @@ -0,0 +1,26 @@ += 70000)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 7.0.0". You are running ' . PHP_VERSION . '.'; +} + +if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); + } elseif (!headers_sent()) { + echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; + } + } + trigger_error( + 'Composer detected issues in your platform: ' . implode(' ', $issues), + E_USER_ERROR + ); +} diff --git a/auth/cas/CAS/vendor/psr/log/LICENSE b/auth/cas/CAS/vendor/psr/log/LICENSE new file mode 100644 index 00000000000..474c952b4b5 --- /dev/null +++ b/auth/cas/CAS/vendor/psr/log/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2012 PHP Framework Interoperability Group + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/auth/cas/CAS/vendor/psr/log/Psr/Log/AbstractLogger.php b/auth/cas/CAS/vendor/psr/log/Psr/Log/AbstractLogger.php new file mode 100644 index 00000000000..e02f9daf3d5 --- /dev/null +++ b/auth/cas/CAS/vendor/psr/log/Psr/Log/AbstractLogger.php @@ -0,0 +1,128 @@ +log(LogLevel::EMERGENCY, $message, $context); + } + + /** + * Action must be taken immediately. + * + * Example: Entire website down, database unavailable, etc. This should + * trigger the SMS alerts and wake you up. + * + * @param string $message + * @param mixed[] $context + * + * @return void + */ + public function alert($message, array $context = array()) + { + $this->log(LogLevel::ALERT, $message, $context); + } + + /** + * Critical conditions. + * + * Example: Application component unavailable, unexpected exception. + * + * @param string $message + * @param mixed[] $context + * + * @return void + */ + public function critical($message, array $context = array()) + { + $this->log(LogLevel::CRITICAL, $message, $context); + } + + /** + * Runtime errors that do not require immediate action but should typically + * be logged and monitored. + * + * @param string $message + * @param mixed[] $context + * + * @return void + */ + public function error($message, array $context = array()) + { + $this->log(LogLevel::ERROR, $message, $context); + } + + /** + * Exceptional occurrences that are not errors. + * + * Example: Use of deprecated APIs, poor use of an API, undesirable things + * that are not necessarily wrong. + * + * @param string $message + * @param mixed[] $context + * + * @return void + */ + public function warning($message, array $context = array()) + { + $this->log(LogLevel::WARNING, $message, $context); + } + + /** + * Normal but significant events. + * + * @param string $message + * @param mixed[] $context + * + * @return void + */ + public function notice($message, array $context = array()) + { + $this->log(LogLevel::NOTICE, $message, $context); + } + + /** + * Interesting events. + * + * Example: User logs in, SQL logs. + * + * @param string $message + * @param mixed[] $context + * + * @return void + */ + public function info($message, array $context = array()) + { + $this->log(LogLevel::INFO, $message, $context); + } + + /** + * Detailed debug information. + * + * @param string $message + * @param mixed[] $context + * + * @return void + */ + public function debug($message, array $context = array()) + { + $this->log(LogLevel::DEBUG, $message, $context); + } +} diff --git a/auth/cas/CAS/vendor/psr/log/Psr/Log/InvalidArgumentException.php b/auth/cas/CAS/vendor/psr/log/Psr/Log/InvalidArgumentException.php new file mode 100644 index 00000000000..67f852d1dbc --- /dev/null +++ b/auth/cas/CAS/vendor/psr/log/Psr/Log/InvalidArgumentException.php @@ -0,0 +1,7 @@ +logger = $logger; + } +} diff --git a/auth/cas/CAS/vendor/psr/log/Psr/Log/LoggerInterface.php b/auth/cas/CAS/vendor/psr/log/Psr/Log/LoggerInterface.php new file mode 100644 index 00000000000..2206cfde41a --- /dev/null +++ b/auth/cas/CAS/vendor/psr/log/Psr/Log/LoggerInterface.php @@ -0,0 +1,125 @@ +log(LogLevel::EMERGENCY, $message, $context); + } + + /** + * Action must be taken immediately. + * + * Example: Entire website down, database unavailable, etc. This should + * trigger the SMS alerts and wake you up. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function alert($message, array $context = array()) + { + $this->log(LogLevel::ALERT, $message, $context); + } + + /** + * Critical conditions. + * + * Example: Application component unavailable, unexpected exception. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function critical($message, array $context = array()) + { + $this->log(LogLevel::CRITICAL, $message, $context); + } + + /** + * Runtime errors that do not require immediate action but should typically + * be logged and monitored. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function error($message, array $context = array()) + { + $this->log(LogLevel::ERROR, $message, $context); + } + + /** + * Exceptional occurrences that are not errors. + * + * Example: Use of deprecated APIs, poor use of an API, undesirable things + * that are not necessarily wrong. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function warning($message, array $context = array()) + { + $this->log(LogLevel::WARNING, $message, $context); + } + + /** + * Normal but significant events. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function notice($message, array $context = array()) + { + $this->log(LogLevel::NOTICE, $message, $context); + } + + /** + * Interesting events. + * + * Example: User logs in, SQL logs. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function info($message, array $context = array()) + { + $this->log(LogLevel::INFO, $message, $context); + } + + /** + * Detailed debug information. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function debug($message, array $context = array()) + { + $this->log(LogLevel::DEBUG, $message, $context); + } + + /** + * Logs with an arbitrary level. + * + * @param mixed $level + * @param string $message + * @param array $context + * + * @return void + * + * @throws \Psr\Log\InvalidArgumentException + */ + abstract public function log($level, $message, array $context = array()); +} diff --git a/auth/cas/CAS/vendor/psr/log/Psr/Log/NullLogger.php b/auth/cas/CAS/vendor/psr/log/Psr/Log/NullLogger.php new file mode 100644 index 00000000000..c8f7293b1c6 --- /dev/null +++ b/auth/cas/CAS/vendor/psr/log/Psr/Log/NullLogger.php @@ -0,0 +1,30 @@ +logger) { }` + * blocks. + */ +class NullLogger extends AbstractLogger +{ + /** + * Logs with an arbitrary level. + * + * @param mixed $level + * @param string $message + * @param array $context + * + * @return void + * + * @throws \Psr\Log\InvalidArgumentException + */ + public function log($level, $message, array $context = array()) + { + // noop + } +} diff --git a/auth/cas/CAS/vendor/psr/log/Psr/Log/Test/DummyTest.php b/auth/cas/CAS/vendor/psr/log/Psr/Log/Test/DummyTest.php new file mode 100644 index 00000000000..9638c110186 --- /dev/null +++ b/auth/cas/CAS/vendor/psr/log/Psr/Log/Test/DummyTest.php @@ -0,0 +1,18 @@ + ". + * + * Example ->error('Foo') would yield "error Foo". + * + * @return string[] + */ + abstract public function getLogs(); + + public function testImplements() + { + $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger()); + } + + /** + * @dataProvider provideLevelsAndMessages + */ + public function testLogsAtAllLevels($level, $message) + { + $logger = $this->getLogger(); + $logger->{$level}($message, array('user' => 'Bob')); + $logger->log($level, $message, array('user' => 'Bob')); + + $expected = array( + $level.' message of level '.$level.' with context: Bob', + $level.' message of level '.$level.' with context: Bob', + ); + $this->assertEquals($expected, $this->getLogs()); + } + + public function provideLevelsAndMessages() + { + return array( + LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), + LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), + LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), + LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), + LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), + LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), + LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), + LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), + ); + } + + /** + * @expectedException \Psr\Log\InvalidArgumentException + */ + public function testThrowsOnInvalidLevel() + { + $logger = $this->getLogger(); + $logger->log('invalid level', 'Foo'); + } + + public function testContextReplacement() + { + $logger = $this->getLogger(); + $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); + + $expected = array('info {Message {nothing} Bob Bar a}'); + $this->assertEquals($expected, $this->getLogs()); + } + + public function testObjectCastToString() + { + if (method_exists($this, 'createPartialMock')) { + $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString')); + } else { + $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString')); + } + $dummy->expects($this->once()) + ->method('__toString') + ->will($this->returnValue('DUMMY')); + + $this->getLogger()->warning($dummy); + + $expected = array('warning DUMMY'); + $this->assertEquals($expected, $this->getLogs()); + } + + public function testContextCanContainAnything() + { + $closed = fopen('php://memory', 'r'); + fclose($closed); + + $context = array( + 'bool' => true, + 'null' => null, + 'string' => 'Foo', + 'int' => 0, + 'float' => 0.5, + 'nested' => array('with object' => new DummyTest), + 'object' => new \DateTime, + 'resource' => fopen('php://memory', 'r'), + 'closed' => $closed, + ); + + $this->getLogger()->warning('Crazy context data', $context); + + $expected = array('warning Crazy context data'); + $this->assertEquals($expected, $this->getLogs()); + } + + public function testContextExceptionKeyCanBeExceptionOrOtherValues() + { + $logger = $this->getLogger(); + $logger->warning('Random message', array('exception' => 'oops')); + $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); + + $expected = array( + 'warning Random message', + 'critical Uncaught Exception!' + ); + $this->assertEquals($expected, $this->getLogs()); + } +} diff --git a/auth/cas/CAS/vendor/psr/log/Psr/Log/Test/TestLogger.php b/auth/cas/CAS/vendor/psr/log/Psr/Log/Test/TestLogger.php new file mode 100644 index 00000000000..1be3230496b --- /dev/null +++ b/auth/cas/CAS/vendor/psr/log/Psr/Log/Test/TestLogger.php @@ -0,0 +1,147 @@ + $level, + 'message' => $message, + 'context' => $context, + ]; + + $this->recordsByLevel[$record['level']][] = $record; + $this->records[] = $record; + } + + public function hasRecords($level) + { + return isset($this->recordsByLevel[$level]); + } + + public function hasRecord($record, $level) + { + if (is_string($record)) { + $record = ['message' => $record]; + } + return $this->hasRecordThatPasses(function ($rec) use ($record) { + if ($rec['message'] !== $record['message']) { + return false; + } + if (isset($record['context']) && $rec['context'] !== $record['context']) { + return false; + } + return true; + }, $level); + } + + public function hasRecordThatContains($message, $level) + { + return $this->hasRecordThatPasses(function ($rec) use ($message) { + return strpos($rec['message'], $message) !== false; + }, $level); + } + + public function hasRecordThatMatches($regex, $level) + { + return $this->hasRecordThatPasses(function ($rec) use ($regex) { + return preg_match($regex, $rec['message']) > 0; + }, $level); + } + + public function hasRecordThatPasses(callable $predicate, $level) + { + if (!isset($this->recordsByLevel[$level])) { + return false; + } + foreach ($this->recordsByLevel[$level] as $i => $rec) { + if (call_user_func($predicate, $rec, $i)) { + return true; + } + } + return false; + } + + public function __call($method, $args) + { + if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { + $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; + $level = strtolower($matches[2]); + if (method_exists($this, $genericMethod)) { + $args[] = $level; + return call_user_func_array([$this, $genericMethod], $args); + } + } + throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); + } + + public function reset() + { + $this->records = []; + $this->recordsByLevel = []; + } +} diff --git a/auth/cas/CAS/vendor/psr/log/README.md b/auth/cas/CAS/vendor/psr/log/README.md new file mode 100644 index 00000000000..a9f20c437b3 --- /dev/null +++ b/auth/cas/CAS/vendor/psr/log/README.md @@ -0,0 +1,58 @@ +PSR Log +======= + +This repository holds all interfaces/classes/traits related to +[PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md). + +Note that this is not a logger of its own. It is merely an interface that +describes a logger. See the specification for more details. + +Installation +------------ + +```bash +composer require psr/log +``` + +Usage +----- + +If you need a logger, you can use the interface like this: + +```php +logger = $logger; + } + + public function doSomething() + { + if ($this->logger) { + $this->logger->info('Doing work'); + } + + try { + $this->doSomethingElse(); + } catch (Exception $exception) { + $this->logger->error('Oh no!', array('exception' => $exception)); + } + + // do something useful + } +} +``` + +You can then pick one of the implementations of the interface to get a logger. + +If you want to implement the interface, you can require this package and +implement `Psr\Log\LoggerInterface` in your code. Please read the +[specification text](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) +for details. diff --git a/auth/cas/CAS/vendor/psr/log/composer.json b/auth/cas/CAS/vendor/psr/log/composer.json new file mode 100644 index 00000000000..ca056953770 --- /dev/null +++ b/auth/cas/CAS/vendor/psr/log/composer.json @@ -0,0 +1,26 @@ +{ + "name": "psr/log", + "description": "Common interface for logging libraries", + "keywords": ["psr", "psr-3", "log"], + "homepage": "https://github.com/php-fig/log", + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "require": { + "php": ">=5.3.0" + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + } +}