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/
-[](https://travis-ci.org/apereo/phpCAS)
-
+[](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__)