diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2d60aad3d..257b1e171 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -131,7 +131,7 @@ Our tests are located in the `test/` directory, containing a PHPUnit config file When your code is working, please: -* stash as much as possible your commits, +* squash as much as possible your commits, * rebase your branch on our repo last commit, * create a pull request. diff --git a/datamodels/2.x/authent-cas/composer.json b/datamodels/2.x/authent-cas/composer.json index 91734a0ed..ed79777b6 100644 --- a/datamodels/2.x/authent-cas/composer.json +++ b/datamodels/2.x/authent-cas/composer.json @@ -1,5 +1,13 @@ { - "require" : { - "apereo/phpcas" : "~1.3" - } + "config" : { + "classmap-authoritative" : true + }, + "autoload" : { + "psr-4" : { + "Combodo\\iTop\\Cas\\" : "src" + } + }, + "require" : { + "apereo/phpcas" : "~1.6.0" + } } \ No newline at end of file diff --git a/datamodels/2.x/authent-cas/composer.lock b/datamodels/2.x/authent-cas/composer.lock index 4f4b75cd3..91d670750 100644 --- a/datamodels/2.x/authent-cas/composer.lock +++ b/datamodels/2.x/authent-cas/composer.lock @@ -4,28 +4,32 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4db4df78154f0de344ba35a27fe766b7", + "content-hash": "46afbbe7e92c2ccfe403f366ef1877e5", "packages": [ { "name": "apereo/phpcas", - "version": "1.3.7", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/apereo/phpCAS.git", - "reference": "b5b29102c3a42f570c4a3e852f3cf67cae6d6082" + "reference": "f817c72a961484afef95ac64a9257c8e31f063b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/apereo/phpCAS/zipball/b5b29102c3a42f570c4a3e852f3cf67cae6d6082", - "reference": "b5b29102c3a42f570c4a3e852f3cf67cae6d6082", + "url": "https://api.github.com/repos/apereo/phpCAS/zipball/f817c72a961484afef95ac64a9257c8e31f063b9", + "reference": "f817c72a961484afef95ac64a9257c8e31f063b9", "shasum": "" }, "require": { "ext-curl": "*", - "php": ">=5.4.0" + "ext-dom": "*", + "php": ">=7.1.0", + "psr/log": "^1.0 || ^2.0 || ^3.0" }, "require-dev": { - "phpunit/phpunit": "~3.7.10" + "monolog/monolog": "^1.0.0 || ^2.0.0", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": ">=7.5" }, "type": "library", "extra": { @@ -45,11 +49,16 @@ "authors": [ { "name": "Joachim Fritschi", - "homepage": "https://wiki.jasig.org/display/~fritschi" + "email": "jfritschi@freenet.de", + "homepage": "https://github.com/jfritschi" }, { "name": "Adam Franco", - "homepage": "https://wiki.jasig.org/display/~adamfranco" + "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", @@ -59,7 +68,61 @@ "cas", "jasig" ], - "time": "2019-04-22T19:48:16+00:00" + "support": { + "issues": "https://github.com/apereo/phpCAS/issues", + "source": "https://github.com/apereo/phpCAS/tree/1.6.0" + }, + "time": "2022-10-31T20:39:27+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "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" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "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" + }, + "time": "2021-05-03T11:20:27+00:00" } ], "packages-dev": [], @@ -69,5 +132,6 @@ "prefer-stable": false, "prefer-lowest": false, "platform": [], - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "2.1.0" } diff --git a/datamodels/2.x/authent-cas/main.php b/datamodels/2.x/authent-cas/main.php deleted file mode 100644 index aa7e99d1d..000000000 --- a/datamodels/2.x/authent-cas/main.php +++ /dev/null @@ -1,4 +0,0 @@ - array( 'model.authent-cas.php', - 'main.php' + 'vendor/autoload.php', + 'src/CASLoginExtension.php', ), 'webservice' => array( @@ -50,6 +51,7 @@ SetupWebPage::AddModule( 'cas_port' => '', 'cas_context' => '', 'cas_version' => '', + 'service_base_url' => '', ), ) ); diff --git a/datamodels/2.x/authent-cas/src/CASLog.php b/datamodels/2.x/authent-cas/src/CASLog.php new file mode 100644 index 000000000..85d3c7e59 --- /dev/null +++ b/datamodels/2.x/authent-cas/src/CASLog.php @@ -0,0 +1,17 @@ + LogAPI::LEVEL_ERROR, + LogLevel::ALERT => LogAPI::LEVEL_ERROR, + LogLevel::CRITICAL => LogAPI::LEVEL_ERROR, + LogLevel::ERROR => LogAPI::LEVEL_ERROR, + LogLevel::WARNING => LogAPI::LEVEL_WARNING, + LogLevel::NOTICE => LogAPI::LEVEL_INFO, + LogLevel::INFO => LogAPI::LEVEL_INFO, + LogLevel::DEBUG => LogAPI::LEVEL_DEBUG, + ]; + + public function emergency($message, array $context = array()) + { + CASLog::Error('EMERGENCY: '.$message, CASLog::CHANNEL_DEFAULT, $context); + IssueLog::Error('EMERGENCY: '.$message, CASLog::CHANNEL_DEFAULT, $context); + } + + public function alert($message, array $context = array()) + { + CASLog::Error('ALERT: '.$message, CASLog::CHANNEL_DEFAULT, $context); + IssueLog::Error('ALERT: '.$message, CASLog::CHANNEL_DEFAULT, $context); + } + + public function critical($message, array $context = array()) + { + CASLog::Error('CRITICAL: '.$message, CASLog::CHANNEL_DEFAULT, $context); + IssueLog::Error('CRITICAL: '.$message, CASLog::CHANNEL_DEFAULT, $context); + } + + public function error($message, array $context = array()) + { + CASLog::Error('ERROR: '.$message, CASLog::CHANNEL_DEFAULT, $context); + IssueLog::Error('ERROR: '.$message, CASLog::CHANNEL_DEFAULT, $context); + } + + public function warning($message, array $context = array()) + { + CASLog::Warning('WARNING: '.$message, CASLog::CHANNEL_DEFAULT, $context); + } + + public function notice($message, array $context = array()) + { + CASLog::Info('NOTICE: '.$message, CASLog::CHANNEL_DEFAULT, $context); + } + + public function info($message, array $context = array()) + { + CASLog::Info('INFO: '.$message, CASLog::CHANNEL_DEFAULT, $context); + } + + public function debug($message, array $context = array()) + { + CASLog::Debug('DEBUG: '.$message, CASLog::CHANNEL_DEFAULT, $context); + } + + public function log($level, $message, array $context = array()) + { + $sLevel = self::LEVEL_COMPAT[$level] ?? LogAPI::LEVEL_ERROR; + CASLog::Log($sLevel, strtoupper($level).": $message", CASLog::CHANNEL_DEFAULT, $context); + } +} \ No newline at end of file diff --git a/datamodels/2.x/authent-cas/src/CASLoginExtension.php b/datamodels/2.x/authent-cas/src/CASLoginExtension.php index 9d8d6e6c0..b092cac13 100644 --- a/datamodels/2.x/authent-cas/src/CASLoginExtension.php +++ b/datamodels/2.x/authent-cas/src/CASLoginExtension.php @@ -153,7 +153,7 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte $bCASDebug = Config::Get('cas_debug'); if ($bCASDebug) { - phpCAS::setDebug(APPROOT.'log/cas.log'); + phpCAS::setLogger(new CASLogger(APPROOT.'log/cas.log')); } // Initialize phpCAS @@ -161,7 +161,8 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte $sCASHost = Config::Get('cas_host'); $iCASPort = Config::Get('cas_port'); $sCASContext = Config::Get('cas_context'); - phpCAS::client($sCASVersion, $sCASHost, $iCASPort, $sCASContext, false /* session already started */); + $sServiceBaseURL = Config::Get('service_base_url', self::GetServiceBaseURL()); + phpCAS::client($sCASVersion, $sCASHost, $iCASPort, $sCASContext, $sServiceBaseURL, false /* session already started */); $sCASCACertPath = Config::Get('cas_server_ca_cert_path'); if (empty($sCASCACertPath)) { @@ -177,6 +178,38 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte } } + private static function GetServiceBaseURL() + { + $protocol = $_SERVER['REQUEST_SCHEME']; + $protocol .= '://'; + if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) { + // explode the host list separated by comma and use the first host + $hosts = explode(',', $_SERVER['HTTP_X_FORWARDED_HOST']); + // see rfc7239#5.3 and rfc7230#2.7.1: port is in HTTP_X_FORWARDED_HOST if non default + return $protocol . $hosts[0]; + } else if (!empty($_SERVER['HTTP_X_FORWARDED_SERVER'])) { + $server_url = $_SERVER['HTTP_X_FORWARDED_SERVER']; + } else { + if (empty($_SERVER['SERVER_NAME'])) { + $server_url = $_SERVER['HTTP_HOST']; + } else { + $server_url = $_SERVER['SERVER_NAME']; + } + } + if (!strpos($server_url, ':')) { + if (empty($_SERVER['HTTP_X_FORWARDED_PORT'])) { + $server_port = $_SERVER['SERVER_PORT']; + } else { + $ports = explode(',', $_SERVER['HTTP_X_FORWARDED_PORT']); + $server_port = $ports[0]; + } + + $server_url .= ':'; + $server_url .= $server_port; + } + return $protocol . $server_url; + } + private function DoUserProvisioning($sLogin) { $bCASUserSynchro = Config::Get('cas_user_synchro'); diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/CAS.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/CAS.php index 8cd549ea3..6ddcf07bc 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/CAS.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/CAS.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS.php * @category Authentication @@ -27,4 +27,6 @@ * @link https://wiki.jasig.org/display/CASC/phpCAS */ -require_once dirname(__FILE__).'/source/CAS.php'; \ No newline at end of file +require_once __DIR__.'/source/CAS.php'; + +trigger_error('Including CAS.php is deprecated. Install phpCAS using composer instead.', E_USER_DEPRECATED); diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/README.md b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/README.md index f425edca8..d48128912 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/README.md +++ b/datamodels/2.x/authent-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) - +[![Test](https://github.com/apereo/phpCAS/actions/workflows/test.yml/badge.svg)](https://github.com/apereo/phpCAS/actions/workflows/test.yml) 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/datamodels/2.x/authent-cas/vendor/apereo/phpcas/composer.json b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/composer.json index 603595b27..89ab7b9f6 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/composer.json +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/composer.json @@ -1,29 +1,55 @@ { - "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://wiki.jasig.org/display/~fritschi"}, - {"name": "Adam Franco", "homepage": "https://wiki.jasig.org/display/~adamfranco"} - ], - "require": { - "php": ">=5.4.0", - "ext-curl": "*" + "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.1.0", + "ext-curl" : "*", + "ext-dom" : "*", + "psr/log" : "^1.0 || ^2.0 || ^3.0" }, - "require-dev": { - "phpunit/phpunit": "~3.7.10" - }, - "autoload": { - "classmap": [ - "source/" - ] - }, - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - } + "require-dev" : { + "monolog/monolog" : "^1.0.0 || ^2.0.0", + "phpunit/phpunit" : ">=7.5", + "phpstan/phpstan" : "^1.5" + }, + "autoload" : { + "classmap" : [ + "source/" + ] + }, + "autoload-dev" : { + "files": ["source/CAS.php"], + "psr-4" : { + "PhpCas\\" : "test/CAS/" + } + }, + "scripts" : { + "test" : "phpunit", + "phpstan" : "phpstan" + }, + "extra" : { + "branch-alias" : { + "dev-master" : "1.3.x-dev" + } + } } diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS.php index dd17a48e4..8243a83e3 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS.php @@ -20,7 +20,7 @@ * * * Interface class of the phpCAS library - * PHP Version 5 + * PHP Version 7 * * @file CAS/CAS.php * @category Authentication @@ -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.7'); +define('PHPCAS_VERSION', '1.6.0'); /** * @addtogroup public @@ -140,11 +136,6 @@ define("SAML_SOAP_ENV_CLOSE", ''); */ define("SAML_ATTRIBUTES", 'SAMLATTRIBS'); -/** - * SAML Attributes - */ -define("DEFAULT_ERROR", 'Internal script failure'); - /** @} */ /** * @addtogroup publicPGTStorage @@ -224,6 +215,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 +254,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 +323,22 @@ 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 string|string[]|CAS_ServiceBaseUrl_Interface + * $service_base_url the base URL (protocol, host and the + * optional port) of the CAS client; pass + * in an array to use auto discovery with + * an allowlist; pass in + * CAS_ServiceBaseUrl_Interface for custom + * behavior. Added in 1.6.0. Similar to + * serverName config in other CAS clients. + * @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 +346,8 @@ class phpCAS * and phpCAS::setDebug()). */ public static function client($server_version, $server_hostname, - $server_port, $server_uri, $changeSessionID = true + $server_port, $server_uri, $service_base_url, + $changeSessionID = true, \SessionHandlerInterface $sessionHandler = null ) { phpCAS :: traceBegin(); if (is_object(self::$_PHPCAS_CLIENT)) { @@ -362,8 +366,8 @@ class phpCAS // initialize the object $_PHPCAS_CLIENT try { self::$_PHPCAS_CLIENT = new CAS_Client( - $server_version, false, $server_hostname, $server_port, $server_uri, - $changeSessionID + $server_version, false, $server_hostname, $server_port, $server_uri, $service_base_url, + $changeSessionID, $sessionHandler ); } catch (Exception $e) { phpCAS :: error(get_class($e) . ': ' . $e->getMessage()); @@ -374,12 +378,22 @@ 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 string|string[]|CAS_ServiceBaseUrl_Interface + * $service_base_url the base URL (protocol, host and the + * optional port) of the CAS client; pass + * in an array to use auto discovery with + * an allowlist; pass in + * CAS_ServiceBaseUrl_Interface for custom + * behavior. Added in 1.6.0. Similar to + * serverName config in other CAS clients. + * @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 +401,8 @@ class phpCAS * and phpCAS::setDebug()). */ public static function proxy($server_version, $server_hostname, - $server_port, $server_uri, $changeSessionID = true + $server_port, $server_uri, $service_base_url, + $changeSessionID = true, \SessionHandlerInterface $sessionHandler = null ) { phpCAS :: traceBegin(); if (is_object(self::$_PHPCAS_CLIENT)) { @@ -406,8 +421,8 @@ class phpCAS // initialize the object $_PHPCAS_CLIENT try { self::$_PHPCAS_CLIENT = new CAS_Client( - $server_version, true, $server_hostname, $server_port, $server_uri, - $changeSessionID + $server_version, true, $server_hostname, $server_port, $server_uri, $service_base_url, + $changeSessionID, $sessionHandler ); } catch (Exception $e) { phpCAS :: error(get_class($e) . ': ' . $e->getMessage()); @@ -435,6 +450,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 +475,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 +555,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 +563,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']); + } } } @@ -567,8 +610,6 @@ class phpCAS } if (self::$_PHPCAS_VERBOSE) { echo "
\nphpCAS error: " . __CLASS__ . "::" . $function . '(): ' . htmlentities($msg) . " in " . $file . " on line " . $line . "
\n"; - } else { - echo "
\nError: ". DEFAULT_ERROR ."
\n"; } phpCAS :: trace($msg . ' in ' . $file . 'on line ' . $line ); phpCAS :: traceEnd(); @@ -1869,6 +1910,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/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/AuthenticationException.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/AuthenticationException.php index 3b73685ff..803c88908 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/AuthenticationException.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/AuthenticationException.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/AuthenticationException.php * @category Authentication @@ -72,11 +72,15 @@ implements CAS_Exception phpCAS::traceBegin(); $lang = $client->getLangObj(); $client->printHTMLHeader($lang->getAuthenticationFailed()); - printf( - $lang->getYouWereNotAuthenticated(), - htmlentities($client->getURL()), - isset($_SERVER['SERVER_ADMIN']) ? $_SERVER['SERVER_ADMIN']:'' - ); + + if (phpCAS::getVerbose()) { + printf( + $lang->getYouWereNotAuthenticated(), + htmlentities($client->getURL()), + $_SERVER['SERVER_ADMIN'] ?? '' + ); + } + phpCAS::trace($messages[] = 'CAS URL: '.$cas_url); phpCAS::trace($messages[] = 'Authentication failure: '.$failure); if ( $no_response ) { diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Autoload.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Autoload.php index 5e9b140c7..29395d592 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Autoload.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Autoload.php @@ -3,7 +3,7 @@ /** * Autoloader Class * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Autoload.php * @category Authentication @@ -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="' @@ -61,22 +68,22 @@ function CAS_autoload($class) ); $trace = $e->getTrace(); if (isset($trace[2]) && isset($trace[2]['function']) - && in_array($trace[2]['function'], array('class_exists', 'interface_exists')) + && in_array($trace[2]['function'], array('class_exists', 'interface_exists', 'trait_exists')) ) { return false; } if (isset($trace[1]) && isset($trace[1]['function']) - && in_array($trace[1]['function'], array('class_exists', 'interface_exists')) + && in_array($trace[1]['function'], array('class_exists', 'interface_exists', 'trait_exists')) ) { return false; } 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()) @@ -86,5 +93,3 @@ if (!(spl_autoload_functions()) spl_autoload_register('__autoload'); } } - -?> diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Client.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Client.php index 338bd50c4..91642ee52 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Client.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Client.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Client.php * @category Authentication @@ -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 * @@ -100,6 +102,10 @@ class CAS_Client */ public function printHTMLHeader($title) { + if (!phpCAS::getVerbose()) { + return; + } + $this->_htmlFilterOutput( str_replace( '__TITLE__', $title, @@ -128,16 +134,17 @@ class CAS_Client */ public function printHTMLFooter() { + if (!phpCAS::getVerbose()) { + return; + } + $lang = $this->getLangObj(); - $this->_htmlFilterOutput( - empty($this->_output_footer)? - (phpCAS::getVerbose())? - '
phpCAS __PHPCAS_VERSION__ ' - .$lang->getUsingServer() - .' __SERVER_BASE_URL__ (CAS __CAS_VERSION__)
' - :'' - :$this->_output_footer - ); + $message = empty($this->_output_footer) + ? '
phpCAS __PHPCAS_VERSION__ ' . $lang->getUsingServer() . + ' __SERVER_BASE_URL__ (CAS __CAS_VERSION__)
' + : $this->_output_footer; + + $this->_htmlFilterOutput($message); } /** @@ -149,9 +156,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,13 +172,28 @@ 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; } + /** + * Simple wrapper for printf function, that respects + * phpCAS verbosity setting. + * + * @param string $format + * @param string|int|float ...$values + * + * @see printf() + */ + private function printf(string $format, ...$values): void + { + if (phpCAS::getVerbose()) { + printf($format, ...$values); + } + } /** @} */ @@ -200,9 +222,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 +386,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 +403,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 +420,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 +437,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 +578,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 +910,23 @@ 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 string|string[]|CAS_ServiceBaseUrl_Interface + * $service_base_url the base URL (protocol, host and the + * optional port) of the CAS client; pass + * in an array to use auto discovery with + * an allowlist; pass in + * CAS_ServiceBaseUrl_Interface for custom + * behavior. Added in 1.6.0. Similar to + * serverName config in other CAS clients. + * @param \SessionHandlerInterface $sessionHandler the session handler * * @return self a newly created CAS_Client object */ @@ -905,35 +936,53 @@ class CAS_Client $server_hostname, $server_port, $server_uri, - $changeSessionID = true + $service_base_url, + $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'); + + $this->_setServiceBaseUrl($service_base_url); + + 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 +991,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'] ); } @@ -997,12 +1044,23 @@ class CAS_Client // set to callback mode if PgtIou and PgtId CGI GET parameters are provided if ( $this->isProxy() ) { - $this->_setCallbackMode(!empty($_GET['pgtIou'])&&!empty($_GET['pgtId'])); + if(!empty($_GET['pgtIou'])&&!empty($_GET['pgtId'])) { + $this->_setCallbackMode(true); + $this->_setCallbackModeUsingPost(false); + } elseif (!empty($_POST['pgtIou'])&&!empty($_POST['pgtId'])) { + $this->_setCallbackMode(true); + $this->_setCallbackModeUsingPost(true); + } else { + $this->_setCallbackMode(false); + $this->_setCallbackModeUsingPost(false); + } + + } if ( $this->_isCallbackMode() ) { //callback mode: check that phpCAS is secured - if ( !$this->_isHttps() ) { + if ( !$this->getServiceBaseUrl()->isHttps() ) { phpCAS::error( 'CAS proxies must be secured to use phpCAS; PGT\'s will not be received from the CAS server' ); @@ -1010,7 +1068,7 @@ class CAS_Client } else { //normal mode: get ticket and remove it from CGI parameters for // developers - $ticket = (isset($_GET['ticket']) ? $_GET['ticket'] : null); + $ticket = (isset($_GET['ticket']) ? $_GET['ticket'] : ''); if (preg_match('/^[SP]T-/', $ticket) ) { phpCAS::trace('Ticket \''.$ticket.'\' found'); $this->setTicket($ticket); @@ -1040,6 +1098,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 @@ -1047,6 +1107,11 @@ class CAS_Client */ private $_change_session_id = true; + /** + * @var SessionHandlerInterface + */ + private $_sessionHandler; + /** * Set a parameter whether to allow phpCAS to change session_id * @@ -1069,6 +1134,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 @@ -1112,10 +1320,10 @@ class CAS_Client */ public function getUser() { - // Sequence validation - $this->ensureAuthenticationCallSuccessful(); + // Sequence validation + $this->ensureAuthenticationCallSuccessful(); - return $this->_getUser(); + return $this->_getUser(); } /** @@ -1128,7 +1336,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__ @@ -1166,9 +1374,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( @@ -1186,8 +1394,8 @@ class CAS_Client */ public function hasAttributes() { - // Sequence validation - $this->ensureAuthenticationCallSuccessful(); + // Sequence validation + $this->ensureAuthenticationCallSuccessful(); return !empty($this->_attributes); } @@ -1200,8 +1408,8 @@ class CAS_Client */ public function hasAttribute($key) { - // Sequence validation - $this->ensureAuthenticationCallSuccessful(); + // Sequence validation + $this->ensureAuthenticationCallSuccessful(); return $this->_hasAttribute($key); } @@ -1228,8 +1436,8 @@ class CAS_Client */ public function getAttribute($key) { - // Sequence validation - $this->ensureAuthenticationCallSuccessful(); + // Sequence validation + $this->ensureAuthenticationCallSuccessful(); if ($this->_hasAttribute($key)) { return $this->_attributes[$key]; @@ -1247,9 +1455,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; @@ -1278,9 +1484,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; @@ -1306,8 +1510,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; } @@ -1322,34 +1526,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 { @@ -1357,13 +1558,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); @@ -1383,7 +1584,7 @@ class CAS_Client { phpCAS::traceBegin(); $res = false; - $validate_url = ''; + if ( $this->_wasPreviouslyAuthenticated() ) { if ($this->hasTicket()) { // User has a additional ticket but was already authenticated @@ -1417,6 +1618,10 @@ class CAS_Client $this->markAuthenticationCall($res); } else { if ($this->hasTicket()) { + $validate_url = ''; + $text_response = ''; + $tree_response = ''; + switch ($this->getServerVersion()) { case CAS_VERSION_1_0: // if a Service Ticket was given, validate it @@ -1429,7 +1634,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; @@ -1450,15 +1655,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(); @@ -1474,13 +1679,13 @@ 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; default: - phpCAS::trace('Protocoll error'); + phpCAS::trace('Protocol error'); break; } } else { @@ -1529,7 +1734,7 @@ class CAS_Client */ public function isSessionAuthenticated () { - return !empty($_SESSION['phpCAS']['user']); + return !!$this->getSessionValue('user'); } /** @@ -1557,50 +1762,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'); @@ -1609,18 +1814,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')).'"' ); } @@ -1657,7 +1862,7 @@ class CAS_Client phpCAS::trace("Redirect to : ".$cas_url); $lang = $this->getLangObj(); $this->printHTMLHeader($lang->getAuthenticationWanted()); - printf('

'. $lang->getShouldHaveBeenRedirected(). '

', $cas_url); + $this->printf('

'. $lang->getShouldHaveBeenRedirected(). '

', $cas_url); $this->printHTMLFooter(); phpCAS::traceExit(); throw new CAS_GracefullTerminationException(); @@ -1700,7 +1905,7 @@ class CAS_Client } $lang = $this->getLangObj(); $this->printHTMLHeader($lang->getLogout()); - printf('

'.$lang->getShouldHaveBeenRedirected(). '

', $cas_url); + $this->printf('

'.$lang->getShouldHaveBeenRedirected(). '

', $cas_url); $this->printHTMLFooter(); phpCAS::traceExit(); throw new CAS_GracefullTerminationException(); @@ -1944,7 +2149,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; @@ -1989,6 +2194,8 @@ class CAS_Client $validate_url .= '&renew=true'; } + $headers = ''; + $err_msg = ''; // open and read the URL if ( !$this->_readURL($validate_url, $headers, $text_response, $err_msg) ) { phpCAS::trace( @@ -2065,6 +2272,8 @@ class CAS_Client $validate_url .= '&renew=true'; } + $headers = ''; + $err_msg = ''; // open and read the URL if ( !$this->_readURL($validate_url, $headers, $text_response, $err_msg) ) { phpCAS::trace( @@ -2329,6 +2538,36 @@ class CAS_Client return $this->_callback_mode; } + /** + * @var bool a boolean to know if the CAS client is using POST parameters when in callback mode. + * Written by CAS_Client::_setCallbackModeUsingPost(), read by CAS_Client::_isCallbackModeUsingPost(). + * + * @hideinitializer + */ + private $_callback_mode_using_post = false; + + /** + * This method sets/unsets usage of POST parameters in callback mode (default/false is GET parameters) + * + * @param bool $callback_mode_using_post true to use POST, false to use GET (default). + * + * @return void + */ + private function _setCallbackModeUsingPost($callback_mode_using_post) + { + $this->_callback_mode_using_post = $callback_mode_using_post; + } + + /** + * This method returns true when the callback mode is using POST, false otherwise. + * + * @return bool A boolean. + */ + private function _isCallbackModeUsingPost() + { + return $this->_callback_mode_using_post; + } + /** * the URL that should be used for the PGT callback (in fact the URL of the * current request without any CGI parameter). Written and read by @@ -2350,8 +2589,7 @@ class CAS_Client // the URL is built when needed only if ( empty($this->_callback_url) ) { // remove the ticket if present in the URL - $final_uri = 'https://'; - $final_uri .= $this->_getClientUrl(); + $final_uri = $this->getServiceBaseUrl()->get(); $request_uri = $_SERVER['REQUEST_URI']; $request_uri = preg_replace('/\?.*$/', '', $request_uri); $final_uri .= $request_uri; @@ -2369,11 +2607,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; } @@ -2387,23 +2625,35 @@ class CAS_Client private function _callback() { phpCAS::traceBegin(); - if (preg_match('/^PGTIOU-[\.\-\w]+$/', $_GET['pgtIou'])) { - if (preg_match('/^[PT]GT-[\.\-\w]+$/', $_GET['pgtId'])) { - $this->printHTMLHeader('phpCAS callback'); - $pgt_iou = $_GET['pgtIou']; - $pgt = $_GET['pgtId']; - phpCAS::trace('Storing PGT `'.$pgt.'\' (id=`'.$pgt_iou.'\')'); - echo '

Storing PGT `'.$pgt.'\' (id=`'.$pgt_iou.'\').

'; - $this->_storePGT($pgt, $pgt_iou); - $this->printHTMLFooter(); + if ($this->_isCallbackModeUsingPost()) { + $pgtId = $_POST['pgtId']; + $pgtIou = $_POST['pgtIou']; + } else { + $pgtId = $_GET['pgtId']; + $pgtIou = $_GET['pgtIou']; + } + if (preg_match('/^PGTIOU-[\.\-\w]+$/', $pgtIou)) { + if (preg_match('/^[PT]GT-[\.\-\w]+$/', $pgtId)) { + phpCAS::trace('Storing PGT `'.$pgtId.'\' (id=`'.$pgtIou.'\')'); + $this->_storePGT($pgtId, $pgtIou); + if ($this->isXmlResponse()) { + echo '' . "\r\n"; + echo ''; + phpCAS::traceExit("XML response sent"); + } else { + $this->printHTMLHeader('phpCAS callback'); + echo '

Storing PGT `'.$pgtId.'\' (id=`'.$pgtIou.'\').

'; + $this->printHTMLFooter(); + phpCAS::traceExit("HTML response sent"); + } phpCAS::traceExit("Successfull Callback"); } else { - phpCAS::error('PGT format invalid' . $_GET['pgtId']); - phpCAS::traceExit('PGT format invalid' . $_GET['pgtId']); + phpCAS::error('PGT format invalid' . $pgtId); + phpCAS::traceExit('PGT format invalid' . $pgtId); } } else { - phpCAS::error('PGTiou format invalid' . $_GET['pgtIou']); - phpCAS::traceExit('PGTiou format invalid' . $_GET['pgtIou']); + phpCAS::error('PGTiou format invalid' . $pgtIou); + phpCAS::traceExit('PGTiou format invalid' . $pgtIou); } // Flush the buffer to prevent from sending anything other then a 200 @@ -2413,6 +2663,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; + } /** @} */ @@ -2493,7 +2760,7 @@ class CAS_Client */ public function setPGTStorage($storage) { - // Sequence validation + // Sequence validation $this->ensureIsProxy(); // check that the storage has not already been set @@ -2529,18 +2796,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( @@ -2560,12 +2827,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)); @@ -2647,9 +2914,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(); @@ -2663,6 +2930,8 @@ class CAS_Client $cas_url = $this->getServerProxyURL().'?targetService=' .urlencode($target_service).'&pgt='.$this->_getPGT(); + $headers = ''; + $cas_response = ''; // open and read the URL if ( !$this->_readURL($cas_url, $headers, $cas_response, $err_msg) ) { phpCAS::trace( @@ -2869,13 +3138,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: @@ -2920,9 +3189,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)) { @@ -2955,13 +3224,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); @@ -3005,17 +3274,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); @@ -3279,6 +3548,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 @@ -3294,23 +3852,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) ) { @@ -3320,111 +3861,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; @@ -3489,9 +3938,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; } @@ -3508,12 +3957,9 @@ class CAS_Client // the URL is built when needed only if ( empty($this->_url) ) { // remove the ticket if present in the URL - $final_uri = ($this->_isHttps()) ? 'https' : 'http'; - $final_uri .= '://'; - - $final_uri .= $this->_getClientUrl(); - $request_uri = explode('?', $_SERVER['REQUEST_URI'], 2); - $final_uri .= $request_uri[0]; + $final_uri = $this->getServiceBaseUrl()->get(); + $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]); @@ -3521,7 +3967,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"; } } @@ -3541,72 +3987,68 @@ 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; } + /** + * The ServiceBaseUrl object that provides base URL during service URL + * discovery process. + * + * @var CAS_ServiceBaseUrl_Interface + * + * @hideinitializer + */ + private $_serviceBaseUrl = null; /** - * Try to figure out the phpCAS client URL with possible Proxys / Ports etc. + * Answer the CAS_ServiceBaseUrl_Interface object for this client. * - * @return string Server URL with domain:port + * @return CAS_ServiceBaseUrl_Interface */ - private function _getClientUrl() + public function getServiceBaseUrl() { - if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) { - // explode the host list separated by comma and use the first host - $hosts = explode(',', $_SERVER['HTTP_X_FORWARDED_HOST']); - // see rfc7239#5.3 and rfc7230#2.7.1: port is in HTTP_X_FORWARDED_HOST if non default - return $hosts[0]; - } else if (!empty($_SERVER['HTTP_X_FORWARDED_SERVER'])) { - $server_url = $_SERVER['HTTP_X_FORWARDED_SERVER']; - } else { - if (empty($_SERVER['SERVER_NAME'])) { - $server_url = $_SERVER['HTTP_HOST']; - } else { - $server_url = $_SERVER['SERVER_NAME']; - } + if (empty($this->_serviceBaseUrl)) { + phpCAS::error("ServiceBaseUrl object is not initialized"); } - if (!strpos($server_url, ':')) { - if (empty($_SERVER['HTTP_X_FORWARDED_PORT'])) { - $server_port = $_SERVER['SERVER_PORT']; - } else { - $ports = explode(',', $_SERVER['HTTP_X_FORWARDED_PORT']); - $server_port = $ports[0]; - } - - if ( ($this->_isHttps() && $server_port!=443) - || (!$this->_isHttps() && $server_port!=80) - ) { - $server_url .= ':'; - $server_url .= $server_port; - } - } - return $server_url; + return $this->_serviceBaseUrl; } /** - * This method checks to see if the request is secured via HTTPS + * This method sets the service base URL used during service URL discovery process. * - * @return bool true if https, false otherwise + * This is required since phpCAS 1.6.0 to protect the integrity of the authentication. + * + * @since phpCAS 1.6.0 + * + * @param $name can be any of the following: + * - A base URL string. The service URL discovery will always use this (protocol, + * hostname and optional port number) without using any external host names. + * - An array of base URL strings. The service URL discovery will check against + * this list before using the auto discovered base URL. If there is no match, + * the first base URL in the array will be used as the default. This option is + * helpful if your PHP website is accessible through multiple domains without a + * canonical name, or through both HTTP and HTTPS. + * - A class that implements CAS_ServiceBaseUrl_Interface. If you need to customize + * the base URL discovery behavior, you can pass in a class that implements the + * interface. + * + * @return void */ - private function _isHttps() + private function _setServiceBaseUrl($name) { - if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) { - return ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'); - } elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTOCOL'])) { - return ($_SERVER['HTTP_X_FORWARDED_PROTOCOL'] === 'https'); - } elseif ( isset($_SERVER['HTTPS']) - && !empty($_SERVER['HTTPS']) - && strcasecmp($_SERVER['HTTPS'], 'off') !== 0 - ) { - return true; + if (is_array($name)) { + $this->_serviceBaseUrl = new CAS_ServiceBaseUrl_AllowedListDiscovery($name); + } else if (is_string($name)) { + $this->_serviceBaseUrl = new CAS_ServiceBaseUrl_Static($name); + } else if ($name instanceof CAS_ServiceBaseUrl_Interface) { + $this->_serviceBaseUrl = $name; + } else { + throw new CAS_TypeMismatchException($name, '$name', 'array, string, or CAS_ServiceBaseUrl_Interface object'); } - return false; - } /** @@ -3646,38 +4088,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); } /** @@ -3747,7 +4180,7 @@ class CAS_Client phpCAS::traceBegin(); $lang = $this->getLangObj(); $this->printHTMLHeader($lang->getAuthenticationFailed()); - printf( + $this->printf( $lang->getYouWereNotAuthenticated(), htmlentities($this->getURL()), isset($_SERVER['SERVER_ADMIN']) ? $_SERVER['SERVER_ADMIN']:'' ); @@ -3828,9 +4261,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; @@ -3852,8 +4285,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/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/CookieJar.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/CookieJar.php index 38f849dfe..b2439373a 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/CookieJar.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/CookieJar.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/CookieJar.php * @category Authentication @@ -231,6 +231,7 @@ class CAS_CookieJar case 'commenturl': case 'discard': case 'httponly': + case 'samesite': $cookie[$attributeNameLC] = $attributeValue; break; default: diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Exception.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Exception.php index d956d1975..2ff7cd658 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Exception.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Exception.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Exception.php * @category Authentication @@ -56,4 +56,4 @@ interface CAS_Exception { } -?> \ No newline at end of file +?> diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/GracefullTerminationException.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/GracefullTerminationException.php index d1d035c39..29aa638cd 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/GracefullTerminationException.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/GracefullTerminationException.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/GracefullTerminationException.php * @category Authentication @@ -83,4 +83,4 @@ implements CAS_Exception } } -?> \ No newline at end of file +?> diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/InvalidArgumentException.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/InvalidArgumentException.php index ba43d39f8..99be2ac32 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/InvalidArgumentException.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/InvalidArgumentException.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/InvalidArgumentException.php * @category Authentication @@ -43,4 +43,4 @@ implements CAS_Exception { } -?> \ No newline at end of file +?> diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Catalan.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Catalan.php index a0b64d8eb..1ead905fc 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Catalan.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Catalan.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Language/Catalan.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/ChineseSimplified.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/ChineseSimplified.php index bb665937e..5e33cb650 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/ChineseSimplified.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/ChineseSimplified.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Language/ChineseSimplified.php * @category Authentication @@ -111,4 +111,4 @@ class CAS_Languages_ChineseSimplified implements CAS_Languages_LanguageInterface { return '服务器 %s 不可用(%s)。'; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/English.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/English.php index 002c1ba49..cb13bde93 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/English.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/English.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Language/English.php * @category Authentication @@ -111,4 +111,4 @@ class CAS_Languages_English implements CAS_Languages_LanguageInterface { return 'The service `%s\' is not available (%s).'; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/French.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/French.php index b99847a7f..14f65aba2 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/French.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/French.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Language/French.php * @category Authentication @@ -113,4 +113,4 @@ class CAS_Languages_French implements CAS_Languages_LanguageInterface } } -?> \ No newline at end of file +?> diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Galego.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Galego.php new file mode 100644 index 000000000..d5bf40455 --- /dev/null +++ b/datamodels/2.x/authent-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/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/German.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/German.php index ed3150a80..b718b1452 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/German.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/German.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Language/German.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Greek.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Greek.php index 888ce2416..1cfb107e4 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Greek.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Greek.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Language/Greek.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Japanese.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Japanese.php index a15bf17b1..568148458 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Japanese.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Japanese.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Language/Japanese.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/LanguageInterface.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/LanguageInterface.php index 5de93aa7b..dfb0ac514 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/LanguageInterface.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/LanguageInterface.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Language/LanguageInterface.php * @category Authentication @@ -93,4 +93,4 @@ interface CAS_Languages_LanguageInterface public function getServiceUnavailable(); } -?> \ No newline at end of file +?> diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Portuguese.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Portuguese.php new file mode 100644 index 000000000..a927cad62 --- /dev/null +++ b/datamodels/2.x/authent-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/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Spanish.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Spanish.php index 5675a41d8..c6ea50e74 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Spanish.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Languages/Spanish.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Language/Spanish.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeAuthenticationCallException.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeAuthenticationCallException.php index ef8309795..d4d7680de 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeAuthenticationCallException.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeAuthenticationCallException.php @@ -18,7 +18,7 @@ * limitations under the License. * * - * PHP Version 5 + * PHP Version 7 * * @file CAS/OutOfSequenceBeforeAuthenticationCallException.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeClientException.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeClientException.php index f1ea7e244..6c2c39c58 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeClientException.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeClientException.php @@ -18,7 +18,7 @@ * limitations under the License. * * - * PHP Version 5 + * PHP Version 7 * * @file CAS/OutOfSequenceBeforeClientException.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeProxyException.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeProxyException.php index 8038542ed..799155521 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeProxyException.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/OutOfSequenceBeforeProxyException.php @@ -18,7 +18,7 @@ * limitations under the License. * * - * PHP Version 5 + * PHP Version 7 * * @file CAS/OutOfSequenceBeforeProxyException.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/OutOfSequenceException.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/OutOfSequenceException.php index d101811b6..d6f7d88fc 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/OutOfSequenceException.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/OutOfSequenceException.php @@ -18,7 +18,7 @@ * limitations under the License. * * - * PHP Version 5 + * PHP Version 7 * * @file CAS/OutOfSequenceException.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/PGTStorage/AbstractStorage.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/PGTStorage/AbstractStorage.php index 0f3471118..a93568d60 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/PGTStorage/AbstractStorage.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/PGTStorage/AbstractStorage.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/PGTStorage/AbstractStorage.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/PGTStorage/Db.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/PGTStorage/Db.php index 383d11dc7..2efe5a3e8 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/PGTStorage/Db.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/PGTStorage/Db.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/PGTStorage/Db.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/PGTStorage/File.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/PGTStorage/File.php index 6504ec599..fbacd3b7d 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/PGTStorage/File.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/PGTStorage/File.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/PGTStorage/AbstractStorage.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService.php index d70ca9c12..2673ee955 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/ProxiedService.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Abstract.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Abstract.php index fade9e70b..0801c723b 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Abstract.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Abstract.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/ProxiedService/Abstract.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Exception.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Exception.php index 5a1e69622..0f87413dd 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Exception.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Exception.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/ProxiedService/Exception.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Http.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Http.php index 7c9824fab..4240b061a 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Http.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Http.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/ProxiedService/Http.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Abstract.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Abstract.php index 61abfd84f..8d55edd50 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Abstract.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Abstract.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/ProxiedService/Http/Abstract.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Get.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Get.php index 78e35de16..a459d55ae 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Get.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Get.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/ProxiedService/Http/Get.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Post.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Post.php index 7d4ecd3c0..344c43987 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Post.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Http/Post.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/ProxiedService/Http/Post.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Imap.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Imap.php index 385aae73b..c4b47401d 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Imap.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Imap.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/ProxiedService/Imap.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Testable.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Testable.php index 51f076762..3ce44fd16 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Testable.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxiedService/Testable.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/ProxiedService/Testabel.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain.php index 2594d141e..e200724ce 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/ProxyChain.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain/AllowedList.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain/AllowedList.php index cafd0e743..988ddbb3c 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain/AllowedList.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain/AllowedList.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/ProxyChain/AllowedList.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain/Any.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain/Any.php index 0cd92f74e..fe18c5fbf 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain/Any.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain/Any.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/ProxyChain/Any.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain/Interface.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain/Interface.php index d247115db..b1d688174 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain/Interface.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain/Interface.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/ProxyChain/Interface.php * @category Authentication @@ -50,4 +50,4 @@ interface CAS_ProxyChain_Interface */ public function matches(array $list); -} \ No newline at end of file +} diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain/Trusted.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain/Trusted.php index 7fa612967..e67d70852 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain/Trusted.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyChain/Trusted.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/ProxyChain/Trusted.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyTicketException.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyTicketException.php index 723304666..2f825b421 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyTicketException.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ProxyTicketException.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @class CAS/ProxyTicketException.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/AbstractRequest.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/AbstractRequest.php index 130024bf1..4f9013ee2 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/AbstractRequest.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/AbstractRequest.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Request/AbstractRequest.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/CurlMultiRequest.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/CurlMultiRequest.php index 919c9561d..850f6f0e4 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/CurlMultiRequest.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/CurlMultiRequest.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Request/AbstractRequest.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/CurlRequest.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/CurlRequest.php index 70057712e..e30dd0d19 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/CurlRequest.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/CurlRequest.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Request/CurlRequest.php * @category Authentication @@ -106,14 +106,7 @@ implements CAS_Request_RequestInterface *********************************************************/ $ch = curl_init($this->url); - if (version_compare(PHP_VERSION, '5.1.3', '>=')) { - //only avaible in php5 - curl_setopt_array($ch, $this->_curlOptions); - } else { - foreach ($this->_curlOptions as $key => $value) { - curl_setopt($ch, $key, $value); - } - } + curl_setopt_array($ch, $this->_curlOptions); /********************************************************* * Set SSL configuration @@ -167,6 +160,11 @@ implements CAS_Request_RequestInterface curl_setopt($ch, CURLOPT_POSTFIELDS, $this->postBody); } + /********************************************************* + * Set User Agent + *********************************************************/ + curl_setopt($ch, CURLOPT_USERAGENT, 'phpCAS/' . phpCAS::getVersion()); + return $ch; } @@ -179,7 +177,7 @@ implements CAS_Request_RequestInterface * * @return void */ - private function _storeResponseBody ($body) + public function _storeResponseBody ($body) { $this->storeResponseBody($body); } @@ -192,7 +190,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/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/Exception.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/Exception.php index 14ff3c6b0..dd5a2a55a 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/Exception.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/Exception.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Request/Exception.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/MultiRequestInterface.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/MultiRequestInterface.php index f3298274d..41002c777 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/MultiRequestInterface.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/MultiRequestInterface.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Request/MultiRequestInterface.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/RequestInterface.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/RequestInterface.php index cc11ba43d..b8e8772e9 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/RequestInterface.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Request/RequestInterface.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/Request/RequestInterface.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/AllowedListDiscovery.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/AllowedListDiscovery.php new file mode 100644 index 000000000..39d269c05 --- /dev/null +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/AllowedListDiscovery.php @@ -0,0 +1,152 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ + + +/** + * Class that gets the service base URL of the PHP server by HTTP header + * discovery and allowlist check. This is used to generate service URL + * and PGT callback URL. + * + * @class CAS_ServiceBaseUrl_AllowedListDiscovery + * @category Authentication + * @package PhpCAS + * @author Henry Pan + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ + +class CAS_ServiceBaseUrl_AllowedListDiscovery +extends CAS_ServiceBaseUrl_Base +{ + private $_list = array(); + + public function __construct($list) { + if (is_array($list)) { + if (count($list) === 0) { + throw new CAS_InvalidArgumentException('$list should not be empty'); + } + foreach ($list as $value) { + $this->allow($value); + } + } else { + throw new CAS_TypeMismatchException($list, '$list', 'array'); + } + } + + /** + * Add a base URL to the allowed list. + * + * @param $url protocol, host name and port to add to the allowed list + * + * @return void + */ + public function allow($url) + { + $this->_list[] = $this->removeStandardPort($url); + } + + /** + * Check if the server name is allowed by configuration. + * + * @param $name server name to check + * + * @return bool whether the allowed list contains the server name + */ + protected function isAllowed($name) + { + return in_array($name, $this->_list); + } + + /** + * Discover the server name through HTTP headers. + * + * We read: + * - HTTP header X-Forwarded-Host + * - HTTP header X-Forwarded-Server and X-Forwarded-Port + * - HTTP header Host and SERVER_PORT + * - PHP SERVER_NAME (which can change based on the HTTP server used) + * + * The standard port will be omitted (80 for HTTP, 443 for HTTPS). + * + * @return string the discovered, unsanitized server protocol, hostname and port + */ + protected function discover() + { + $isHttps = $this->isHttps(); + $protocol = $isHttps ? 'https' : 'http'; + $protocol .= '://'; + if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) { + // explode the host list separated by comma and use the first host + $hosts = explode(',', $_SERVER['HTTP_X_FORWARDED_HOST']); + // see rfc7239#5.3 and rfc7230#2.7.1: port is in HTTP_X_FORWARDED_HOST if non default + return $protocol . $hosts[0]; + } else if (!empty($_SERVER['HTTP_X_FORWARDED_SERVER'])) { + $server_url = $_SERVER['HTTP_X_FORWARDED_SERVER']; + } else { + if (empty($_SERVER['SERVER_NAME'])) { + $server_url = $_SERVER['HTTP_HOST']; + } else { + $server_url = $_SERVER['SERVER_NAME']; + } + } + if (!strpos($server_url, ':')) { + if (empty($_SERVER['HTTP_X_FORWARDED_PORT'])) { + $server_port = $_SERVER['SERVER_PORT']; + } else { + $ports = explode(',', $_SERVER['HTTP_X_FORWARDED_PORT']); + $server_port = $ports[0]; + } + + $server_url .= ':'; + $server_url .= $server_port; + } + return $protocol . $server_url; + } + + /** + * Get PHP server base URL. + * + * @return string the server protocol, hostname and port + */ + public function get() + { + phpCAS::traceBegin(); + $result = $this->removeStandardPort($this->discover()); + phpCAS::trace("Discovered server base URL: " . $result); + if ($this->isAllowed($result)) { + phpCAS::trace("Server base URL is allowed"); + phpCAS::traceEnd(true); + } else { + $result = $this->_list[0]; + phpCAS::trace("Server base URL is not allowed, using default: " . $result); + phpCAS::traceEnd(false); + } + return $result; + } +} diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/Base.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/Base.php new file mode 100644 index 000000000..6b4d3f306 --- /dev/null +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/Base.php @@ -0,0 +1,98 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ + +/** + * Base class of CAS/ServiceBaseUrl that implements isHTTPS method. + * + * @class CAS_ServiceBaseUrl_Base + * @category Authentication + * @package PhpCAS + * @author Henry Pan + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ +abstract class CAS_ServiceBaseUrl_Base +implements CAS_ServiceBaseUrl_Interface +{ + + /** + * Get PHP server name. + * + * @return string the server hostname and port of the server + */ + abstract public function get(); + + /** + * Check whether HTTPS is used. + * + * This is used to construct the protocol in the URL. + * + * @return bool true if HTTPS is used + */ + public function isHttps() { + if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) { + return ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'); + } elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTOCOL'])) { + return ($_SERVER['HTTP_X_FORWARDED_PROTOCOL'] === 'https'); + } elseif ( isset($_SERVER['HTTPS']) + && !empty($_SERVER['HTTPS']) + && strcasecmp($_SERVER['HTTPS'], 'off') !== 0 + ) { + return true; + } + return false; + } + + /** + * Remove standard HTTP and HTTPS port for discovery and allowlist input. + * + * @param $url URL as https://domain:port without trailing slash + * @return standardized URL, or the original URL + * @throws CAS_InvalidArgumentException if the URL does not include the protocol + */ + protected function removeStandardPort($url) { + if (strpos($url, "://") === false) { + throw new CAS_InvalidArgumentException( + "Configured base URL should include the protocol string: " . $url); + } + + $url = rtrim($url, '/'); + + if (strpos($url, "https://") === 0 && substr_compare($url, ':443', -4) === 0) { + return substr($url, 0, -4); + } + + if (strpos($url, "http://") === 0 && substr_compare($url, ':80', -3) === 0) { + return substr($url, 0, -3); + } + + return $url; + } + +} diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/Interface.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/Interface.php new file mode 100644 index 000000000..77cb2bdc0 --- /dev/null +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/Interface.php @@ -0,0 +1,61 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ + +/** + * An interface for classes that gets the server name of the PHP server. + * This is used to generate service URL and PGT callback URL. + * + * @class CAS_ServiceBaseUrl_Interface + * @category Authentication + * @package PhpCAS + * @author Henry Pan + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ +interface CAS_ServiceBaseUrl_Interface +{ + + /** + * Get PHP HTTP protocol and server name. + * + * @return string protocol, server hostname, and optionally port, + * without trailing slash (https://localhost:8443) + */ + public function get(); + + /** + * Check whether HTTPS is used. + * + * This is used to construct the protocol in the URL. + * + * @return bool true if HTTPS is used + */ + public function isHttps(); + +} diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/Static.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/Static.php new file mode 100644 index 000000000..577ecb979 --- /dev/null +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/Static.php @@ -0,0 +1,69 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ + + +/** + * Class that gets the server name of the PHP server by statically set + * hostname and port. This is used to generate service URL and PGT + * callback URL. + * + * @class CAS_ServiceBaseUrl_Static + * @category Authentication + * @package PhpCAS + * @author Henry Pan + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @link https://wiki.jasig.org/display/CASC/phpCAS + */ + +class CAS_ServiceBaseUrl_Static +extends CAS_ServiceBaseUrl_Base +{ + private $_name = null; + + public function __construct($name) { + if (is_string($name)) { + $this->_name = $this->removeStandardPort($name); + } else { + throw new CAS_TypeMismatchException($name, '$name', 'string'); + } + } + + /** + * Get the server name through static config. + * + * @return string the server hostname and port of the server configured + */ + public function get() + { + phpCAS::traceBegin(); + phpCAS::trace("Returning static server name: " . $this->_name); + phpCAS::traceEnd(true); + return $this->_name; + } +} \ No newline at end of file diff --git a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Session/PhpSession.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/Session/PhpSession.php new file mode 100644 index 000000000..031cbbc70 --- /dev/null +++ b/datamodels/2.x/authent-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/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/TypeMismatchException.php b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/TypeMismatchException.php index 4a13c2df4..72bdc87a1 100644 --- a/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/TypeMismatchException.php +++ b/datamodels/2.x/authent-cas/vendor/apereo/phpcas/source/CAS/TypeMismatchException.php @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * PHP Version 5 + * PHP Version 7 * * @file CAS/InvalidArgumentException.php * @category Authentication diff --git a/datamodels/2.x/authent-cas/vendor/composer/ClassLoader.php b/datamodels/2.x/authent-cas/vendor/composer/ClassLoader.php index 2c72175e7..0cd6055d1 100644 --- a/datamodels/2.x/authent-cas/vendor/composer/ClassLoader.php +++ b/datamodels/2.x/authent-cas/vendor/composer/ClassLoader.php @@ -37,57 +37,130 @@ namespace Composer\Autoload; * * @author Fabien Potencier * @author Jordi Boggiano - * @see http://www.php-fig.org/psr/psr-0/ - * @see http://www.php-fig.org/psr/psr-4/ + * @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', $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-var array + */ public function getClassMap() { return $this->classMap; } /** - * @param array $classMap Class to filename map + * @param string[] $classMap Class to filename map + * @psalm-param array $classMap + * + * @return void */ public function addClassMap(array $classMap) { @@ -102,9 +175,11 @@ class ClassLoader * 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 array|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories + * @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) { @@ -147,11 +222,13 @@ class ClassLoader * 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 array|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories + * @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) { @@ -195,8 +272,10 @@ class ClassLoader * 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 array|string $paths The PSR-0 base directories + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 base directories + * + * @return void */ public function set($prefix, $paths) { @@ -211,10 +290,12 @@ class ClassLoader * 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 array|string $paths The PSR-4 base directories + * @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) { @@ -234,6 +315,8 @@ class ClassLoader * Turns on searching the include path for class files. * * @param bool $useIncludePath + * + * @return void */ public function setUseIncludePath($useIncludePath) { @@ -256,6 +339,8 @@ class ClassLoader * that have not been registered with the class map. * * @param bool $classMapAuthoritative + * + * @return void */ public function setClassMapAuthoritative($classMapAuthoritative) { @@ -276,10 +361,12 @@ class ClassLoader * 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') && ini_get('apc.enabled') ? $apcuPrefix : null; + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; } /** @@ -296,25 +383,44 @@ class ClassLoader * 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 bool|null True if loaded, null otherwise + * @return true|null True if loaded, null otherwise */ public function loadClass($class) { @@ -323,6 +429,8 @@ class ClassLoader return true; } + + return null; } /** @@ -367,6 +475,21 @@ class ClassLoader 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 @@ -377,11 +500,11 @@ class ClassLoader $subPath = $class; while (false !== $lastPos = strrpos($subPath, '\\')) { $subPath = substr($subPath, 0, $lastPos); - $search = $subPath.'\\'; + $search = $subPath . '\\'; if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); foreach ($this->prefixDirsPsr4[$search] as $dir) { - $length = $this->prefixLengthsPsr4[$first][$search]; - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { + if (file_exists($file = $dir . $pathEnd)) { return $file; } } @@ -438,6 +561,10 @@ class ClassLoader * Scope isolated include. * * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + * @private */ function includeFile($file) { diff --git a/datamodels/2.x/authent-cas/vendor/composer/InstalledVersions.php b/datamodels/2.x/authent-cas/vendor/composer/InstalledVersions.php new file mode 100644 index 000000000..7c5502ca4 --- /dev/null +++ b/datamodels/2.x/authent-cas/vendor/composer/InstalledVersions.php @@ -0,0 +1,337 @@ + + * 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 +{ + private static $installed; + private static $canGetVendors; + 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/datamodels/2.x/authent-cas/vendor/composer/autoload_classmap.php b/datamodels/2.x/authent-cas/vendor/composer/autoload_classmap.php index 5396a2faa..04cba0146 100644 --- a/datamodels/2.x/authent-cas/vendor/composer/autoload_classmap.php +++ b/datamodels/2.x/authent-cas/vendor/composer/autoload_classmap.php @@ -16,10 +16,12 @@ return array( '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', @@ -49,6 +51,16 @@ return array( '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_ServiceBaseUrl_AllowedListDiscovery' => $vendorDir . '/apereo/phpcas/source/CAS/ServiceBaseUrl/AllowedListDiscovery.php', + 'CAS_ServiceBaseUrl_Base' => $vendorDir . '/apereo/phpcas/source/CAS/ServiceBaseUrl/Base.php', + 'CAS_ServiceBaseUrl_Interface' => $vendorDir . '/apereo/phpcas/source/CAS/ServiceBaseUrl/Interface.php', + 'CAS_ServiceBaseUrl_Static' => $vendorDir . '/apereo/phpcas/source/CAS/ServiceBaseUrl/Static.php', + 'CAS_Session_PhpSession' => $vendorDir . '/apereo/phpcas/source/CAS/Session/PhpSession.php', 'CAS_TypeMismatchException' => $vendorDir . '/apereo/phpcas/source/CAS/TypeMismatchException.php', + 'Combodo\\iTop\\Cas\\CASLog' => $baseDir . '/src/CASLog.php', + 'Combodo\\iTop\\Cas\\CASLogger' => $baseDir . '/src/CASLogger.php', + 'Combodo\\iTop\\Cas\\CASLoginExtension' => $baseDir . '/src/CASLoginExtension.php', + 'Combodo\\iTop\\Cas\\Config' => $baseDir . '/src/Config.php', + 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 'phpCAS' => $vendorDir . '/apereo/phpcas/source/CAS.php', ); diff --git a/datamodels/2.x/authent-cas/vendor/composer/autoload_psr4.php b/datamodels/2.x/authent-cas/vendor/composer/autoload_psr4.php index b265c64a2..dcb11d390 100644 --- a/datamodels/2.x/authent-cas/vendor/composer/autoload_psr4.php +++ b/datamodels/2.x/authent-cas/vendor/composer/autoload_psr4.php @@ -6,4 +6,5 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( + 'Combodo\\iTop\\Cas\\' => array($baseDir . '/src'), ); diff --git a/datamodels/2.x/authent-cas/vendor/composer/autoload_real.php b/datamodels/2.x/authent-cas/vendor/composer/autoload_real.php index 95f36fa2d..ba22a4082 100644 --- a/datamodels/2.x/authent-cas/vendor/composer/autoload_real.php +++ b/datamodels/2.x/authent-cas/vendor/composer/autoload_real.php @@ -13,38 +13,34 @@ class ComposerAutoloaderInitfbc00f22d0b7b7b490d18e0252e08746 } } + /** + * @return \Composer\Autoload\ClassLoader + */ public static function getLoader() { if (null !== self::$loader) { return self::$loader; } + require __DIR__ . '/platform_check.php'; + spl_autoload_register(array('ComposerAutoloaderInitfbc00f22d0b7b7b490d18e0252e08746', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); spl_autoload_unregister(array('ComposerAutoloaderInitfbc00f22d0b7b7b490d18e0252e08746', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { - require_once __DIR__ . '/autoload_static.php'; + require __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInitfbc00f22d0b7b7b490d18e0252e08746::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->setClassMapAuthoritative(true); $loader->register(true); return $loader; diff --git a/datamodels/2.x/authent-cas/vendor/composer/autoload_static.php b/datamodels/2.x/authent-cas/vendor/composer/autoload_static.php index e9cf76615..1202986ec 100644 --- a/datamodels/2.x/authent-cas/vendor/composer/autoload_static.php +++ b/datamodels/2.x/authent-cas/vendor/composer/autoload_static.php @@ -6,6 +6,20 @@ namespace Composer\Autoload; class ComposerStaticInitfbc00f22d0b7b7b490d18e0252e08746 { + public static $prefixLengthsPsr4 = array ( + 'C' => + array ( + 'Combodo\\iTop\\Cas\\' => 17, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'Combodo\\iTop\\Cas\\' => + array ( + 0 => __DIR__ . '/../..' . '/src', + ), + ); + public static $classMap = array ( 'CAS_AuthenticationException' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/AuthenticationException.php', 'CAS_Client' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Client.php', @@ -17,10 +31,12 @@ class ComposerStaticInitfbc00f22d0b7b7b490d18e0252e08746 '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', @@ -50,13 +66,25 @@ class ComposerStaticInitfbc00f22d0b7b7b490d18e0252e08746 '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_ServiceBaseUrl_AllowedListDiscovery' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ServiceBaseUrl/AllowedListDiscovery.php', + 'CAS_ServiceBaseUrl_Base' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ServiceBaseUrl/Base.php', + 'CAS_ServiceBaseUrl_Interface' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ServiceBaseUrl/Interface.php', + 'CAS_ServiceBaseUrl_Static' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ServiceBaseUrl/Static.php', + 'CAS_Session_PhpSession' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Session/PhpSession.php', 'CAS_TypeMismatchException' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/TypeMismatchException.php', + 'Combodo\\iTop\\Cas\\CASLog' => __DIR__ . '/../..' . '/src/CASLog.php', + 'Combodo\\iTop\\Cas\\CASLogger' => __DIR__ . '/../..' . '/src/CASLogger.php', + 'Combodo\\iTop\\Cas\\CASLoginExtension' => __DIR__ . '/../..' . '/src/CASLoginExtension.php', + 'Combodo\\iTop\\Cas\\Config' => __DIR__ . '/../..' . '/src/Config.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 = ComposerStaticInitfbc00f22d0b7b7b490d18e0252e08746::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitfbc00f22d0b7b7b490d18e0252e08746::$prefixDirsPsr4; $loader->classMap = ComposerStaticInitfbc00f22d0b7b7b490d18e0252e08746::$classMap; }, null, ClassLoader::class); diff --git a/datamodels/2.x/authent-cas/vendor/composer/installed.json b/datamodels/2.x/authent-cas/vendor/composer/installed.json index cb01b031c..68a0853a9 100644 --- a/datamodels/2.x/authent-cas/vendor/composer/installed.json +++ b/datamodels/2.x/authent-cas/vendor/composer/installed.json @@ -1,59 +1,130 @@ -[ - { - "name": "apereo/phpcas", - "version": "1.3.7", - "version_normalized": "1.3.7.0", - "source": { - "type": "git", - "url": "https://github.com/apereo/phpCAS.git", - "reference": "b5b29102c3a42f570c4a3e852f3cf67cae6d6082" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/apereo/phpCAS/zipball/b5b29102c3a42f570c4a3e852f3cf67cae6d6082", - "reference": "b5b29102c3a42f570c4a3e852f3cf67cae6d6082", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "~3.7.10" - }, - "time": "2019-04-22T19:48:16+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", - "homepage": "https://wiki.jasig.org/display/~fritschi" +{ + "packages": [ + { + "name": "apereo/phpcas", + "version": "1.6.0", + "version_normalized": "1.6.0.0", + "source": { + "type": "git", + "url": "https://github.com/apereo/phpCAS.git", + "reference": "f817c72a961484afef95ac64a9257c8e31f063b9" }, - { - "name": "Adam Franco", - "homepage": "https://wiki.jasig.org/display/~adamfranco" - } - ], - "description": "Provides a simple API for authenticating users against a CAS server", - "homepage": "https://wiki.jasig.org/display/CASC/phpCAS", - "keywords": [ - "apereo", - "cas", - "jasig" - ] - } -] + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/apereo/phpCAS/zipball/f817c72a961484afef95ac64a9257c8e31f063b9", + "reference": "f817c72a961484afef95ac64a9257c8e31f063b9", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-dom": "*", + "php": ">=7.1.0", + "psr/log": "^1.0 || ^2.0 || ^3.0" + }, + "require-dev": { + "monolog/monolog": "^1.0.0 || ^2.0.0", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": ">=7.5" + }, + "time": "2022-10-31T20:39:27+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.6.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/datamodels/2.x/authent-cas/vendor/composer/installed.php b/datamodels/2.x/authent-cas/vendor/composer/installed.php new file mode 100644 index 000000000..2a1af2868 --- /dev/null +++ b/datamodels/2.x/authent-cas/vendor/composer/installed.php @@ -0,0 +1,41 @@ + array( + 'pretty_version' => 'dev-develop', + 'version' => 'dev-develop', + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'reference' => 'b56f2f56f107b71ac0e54c88f421fbbd2c99d78d', + 'name' => '__root__', + 'dev' => true, + ), + 'versions' => array( + '__root__' => array( + 'pretty_version' => 'dev-develop', + 'version' => 'dev-develop', + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'reference' => 'b56f2f56f107b71ac0e54c88f421fbbd2c99d78d', + 'dev_requirement' => false, + ), + 'apereo/phpcas' => array( + 'pretty_version' => '1.6.0', + 'version' => '1.6.0.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../apereo/phpcas', + 'aliases' => array(), + 'reference' => 'f817c72a961484afef95ac64a9257c8e31f063b9', + '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/datamodels/2.x/authent-cas/vendor/composer/platform_check.php b/datamodels/2.x/authent-cas/vendor/composer/platform_check.php new file mode 100644 index 000000000..6d3407dbb --- /dev/null +++ b/datamodels/2.x/authent-cas/vendor/composer/platform_check.php @@ -0,0 +1,26 @@ += 70100)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 7.1.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 + ); +}