mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-75479 auth_cas: Update phpCAS to v1.6.0
This commit is contained in:
parent
f1b39db4f0
commit
d2bcdfea0e
13 changed files with 506 additions and 79 deletions
28
auth/cas/CAS/vendor/apereo/phpcas/source/CAS.php
vendored
28
auth/cas/CAS/vendor/apereo/phpcas/source/CAS.php
vendored
|
@ -57,7 +57,7 @@ if (!isset($_SERVER['REQUEST_URI']) && isset($_SERVER['SCRIPT_NAME']) && isset($
|
|||
/**
|
||||
* phpCAS version. accessible for the user by phpCAS::getVersion().
|
||||
*/
|
||||
define('PHPCAS_VERSION', '1.5.0');
|
||||
define('PHPCAS_VERSION', '1.6.0');
|
||||
|
||||
/**
|
||||
* @addtogroup public
|
||||
|
@ -327,6 +327,14 @@ class phpCAS
|
|||
* @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)
|
||||
|
@ -338,7 +346,8 @@ class phpCAS
|
|||
* and phpCAS::setDebug()).
|
||||
*/
|
||||
public static function client($server_version, $server_hostname,
|
||||
$server_port, $server_uri, $changeSessionID = true, \SessionHandlerInterface $sessionHandler = null
|
||||
$server_port, $server_uri, $service_base_url,
|
||||
$changeSessionID = true, \SessionHandlerInterface $sessionHandler = null
|
||||
) {
|
||||
phpCAS :: traceBegin();
|
||||
if (is_object(self::$_PHPCAS_CLIENT)) {
|
||||
|
@ -357,7 +366,7 @@ class phpCAS
|
|||
// initialize the object $_PHPCAS_CLIENT
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT = new CAS_Client(
|
||||
$server_version, false, $server_hostname, $server_port, $server_uri,
|
||||
$server_version, false, $server_hostname, $server_port, $server_uri, $service_base_url,
|
||||
$changeSessionID, $sessionHandler
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
|
@ -373,6 +382,14 @@ class phpCAS
|
|||
* @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)
|
||||
|
@ -384,7 +401,8 @@ class phpCAS
|
|||
* and phpCAS::setDebug()).
|
||||
*/
|
||||
public static function proxy($server_version, $server_hostname,
|
||||
$server_port, $server_uri, $changeSessionID = true, \SessionHandlerInterface $sessionHandler = null
|
||||
$server_port, $server_uri, $service_base_url,
|
||||
$changeSessionID = true, \SessionHandlerInterface $sessionHandler = null
|
||||
) {
|
||||
phpCAS :: traceBegin();
|
||||
if (is_object(self::$_PHPCAS_CLIENT)) {
|
||||
|
@ -403,7 +421,7 @@ class phpCAS
|
|||
// initialize the object $_PHPCAS_CLIENT
|
||||
try {
|
||||
self::$_PHPCAS_CLIENT = new CAS_Client(
|
||||
$server_version, true, $server_hostname, $server_port, $server_uri,
|
||||
$server_version, true, $server_hostname, $server_port, $server_uri, $service_base_url,
|
||||
$changeSessionID, $sessionHandler
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
|
|
|
@ -918,6 +918,14 @@ class CAS_Client
|
|||
* @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
|
||||
|
@ -928,6 +936,7 @@ class CAS_Client
|
|||
$server_hostname,
|
||||
$server_port,
|
||||
$server_uri,
|
||||
$service_base_url,
|
||||
$changeSessionID = true,
|
||||
\SessionHandlerInterface $sessionHandler = null
|
||||
) {
|
||||
|
@ -945,6 +954,8 @@ class CAS_Client
|
|||
if (gettype($changeSessionID) != 'boolean')
|
||||
throw new CAS_TypeMismatchException($changeSessionID, '$changeSessionID', 'boolean');
|
||||
|
||||
$this->_setServiceBaseUrl($service_base_url);
|
||||
|
||||
if (empty($sessionHandler)) {
|
||||
$sessionHandler = new CAS_Session_PhpSession;
|
||||
}
|
||||
|
@ -1049,7 +1060,7 @@ class CAS_Client
|
|||
|
||||
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'
|
||||
);
|
||||
|
@ -2578,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;
|
||||
|
@ -3947,10 +3957,7 @@ 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();
|
||||
$final_uri = $this->getServiceBaseUrl()->get();
|
||||
$request_uri = explode('?', $_SERVER['REQUEST_URI'], 2);
|
||||
$final_uri .= $request_uri[0];
|
||||
|
||||
|
@ -3987,65 +3994,61 @@ class CAS_Client
|
|||
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;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -160,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;
|
||||
}
|
||||
|
||||
|
|
152
auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/AllowedListDiscovery.php
vendored
Normal file
152
auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/AllowedListDiscovery.php
vendored
Normal file
|
@ -0,0 +1,152 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Licensed to Jasig under one or more contributor license
|
||||
* agreements. See the NOTICE file distributed with this work for
|
||||
* additional information regarding copyright ownership.
|
||||
*
|
||||
* Jasig licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file CAS/ServiceBaseUrl/AllowedListDiscovery.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Henry Pan <git@phy25.com>
|
||||
* @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 <git@phy25.com>
|
||||
* @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;
|
||||
}
|
||||
}
|
98
auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/Base.php
vendored
Normal file
98
auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/Base.php
vendored
Normal file
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Licensed to Jasig under one or more contributor license
|
||||
* agreements. See the NOTICE file distributed with this work for
|
||||
* additional information regarding copyright ownership.
|
||||
*
|
||||
* Jasig licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file CAS/ServiceBaseUrl/Base.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Henry Pan <git@phy25.com>
|
||||
* @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 <git@phy25.com>
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
61
auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/Interface.php
vendored
Normal file
61
auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/Interface.php
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Licensed to Jasig under one or more contributor license
|
||||
* agreements. See the NOTICE file distributed with this work for
|
||||
* additional information regarding copyright ownership.
|
||||
*
|
||||
* Jasig licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file CAS/ServerHostname/Interface.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Henry Pan <git@phy25.com>
|
||||
* @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 <git@phy25.com>
|
||||
* @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();
|
||||
|
||||
}
|
69
auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/Static.php
vendored
Normal file
69
auth/cas/CAS/vendor/apereo/phpcas/source/CAS/ServiceBaseUrl/Static.php
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Licensed to Jasig under one or more contributor license
|
||||
* agreements. See the NOTICE file distributed with this work for
|
||||
* additional information regarding copyright ownership.
|
||||
*
|
||||
* Jasig licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file CAS/ServiceBaseUrl/Static.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Henry Pan <git@phy25.com>
|
||||
* @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 <git@phy25.com>
|
||||
* @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;
|
||||
}
|
||||
}
|
19
auth/cas/CAS/vendor/autoload.php
vendored
19
auth/cas/CAS/vendor/autoload.php
vendored
|
@ -3,10 +3,23 @@
|
|||
// autoload.php @generated by Composer
|
||||
|
||||
if (PHP_VERSION_ID < 50600) {
|
||||
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
||||
exit(1);
|
||||
if (!headers_sent()) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
}
|
||||
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
||||
if (!ini_get('display_errors')) {
|
||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||
fwrite(STDERR, $err);
|
||||
} elseif (!headers_sent()) {
|
||||
echo $err;
|
||||
}
|
||||
}
|
||||
trigger_error(
|
||||
$err,
|
||||
E_USER_ERROR
|
||||
);
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit6a071fded0009b95f2f6be5f548a3fa0::getLoader();
|
||||
return ComposerAutoloaderInit8c729390e3f26f25c6e8fe4b9504a4d9::getLoader();
|
||||
|
|
|
@ -51,6 +51,10 @@ 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',
|
||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit6a071fded0009b95f2f6be5f548a3fa0
|
||||
class ComposerAutoloaderInit8c729390e3f26f25c6e8fe4b9504a4d9
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -24,12 +24,12 @@ class ComposerAutoloaderInit6a071fded0009b95f2f6be5f548a3fa0
|
|||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit6a071fded0009b95f2f6be5f548a3fa0', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit8c729390e3f26f25c6e8fe4b9504a4d9', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit6a071fded0009b95f2f6be5f548a3fa0', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit8c729390e3f26f25c6e8fe4b9504a4d9', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit6a071fded0009b95f2f6be5f548a3fa0::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit8c729390e3f26f25c6e8fe4b9504a4d9::getInitializer($loader));
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
|
|
12
auth/cas/CAS/vendor/composer/autoload_static.php
vendored
12
auth/cas/CAS/vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit6a071fded0009b95f2f6be5f548a3fa0
|
||||
class ComposerStaticInit8c729390e3f26f25c6e8fe4b9504a4d9
|
||||
{
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'P' =>
|
||||
|
@ -66,6 +66,10 @@ class ComposerStaticInit6a071fded0009b95f2f6be5f548a3fa0
|
|||
'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',
|
||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||
|
@ -75,9 +79,9 @@ class ComposerStaticInit6a071fded0009b95f2f6be5f548a3fa0
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit6a071fded0009b95f2f6be5f548a3fa0::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit6a071fded0009b95f2f6be5f548a3fa0::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit6a071fded0009b95f2f6be5f548a3fa0::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit8c729390e3f26f25c6e8fe4b9504a4d9::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit8c729390e3f26f25c6e8fe4b9504a4d9::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit8c729390e3f26f25c6e8fe4b9504a4d9::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
14
auth/cas/CAS/vendor/composer/installed.json
vendored
14
auth/cas/CAS/vendor/composer/installed.json
vendored
|
@ -2,17 +2,17 @@
|
|||
"packages": [
|
||||
{
|
||||
"name": "apereo/phpcas",
|
||||
"version": "1.5.0",
|
||||
"version_normalized": "1.5.0.0",
|
||||
"version": "1.6.0",
|
||||
"version_normalized": "1.6.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/apereo/phpCAS.git",
|
||||
"reference": "d6f5797fb568726f34c8e48741776d81e4a2646b"
|
||||
"reference": "f817c72a961484afef95ac64a9257c8e31f063b9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/apereo/phpCAS/zipball/d6f5797fb568726f34c8e48741776d81e4a2646b",
|
||||
"reference": "d6f5797fb568726f34c8e48741776d81e4a2646b",
|
||||
"url": "https://api.github.com/repos/apereo/phpCAS/zipball/f817c72a961484afef95ac64a9257c8e31f063b9",
|
||||
"reference": "f817c72a961484afef95ac64a9257c8e31f063b9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -26,7 +26,7 @@
|
|||
"phpstan/phpstan": "^1.5",
|
||||
"phpunit/phpunit": ">=7.5"
|
||||
},
|
||||
"time": "2022-05-03T21:12:54+00:00",
|
||||
"time": "2022-10-31T20:39:27+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
|
@ -67,7 +67,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/apereo/phpCAS/issues",
|
||||
"source": "https://github.com/apereo/phpCAS/tree/1.5.0"
|
||||
"source": "https://github.com/apereo/phpCAS/tree/1.6.0"
|
||||
},
|
||||
"install-path": "../apereo/phpcas"
|
||||
},
|
||||
|
|
6
auth/cas/CAS/vendor/composer/installed.php
vendored
6
auth/cas/CAS/vendor/composer/installed.php
vendored
|
@ -20,9 +20,9 @@
|
|||
'dev_requirement' => false,
|
||||
),
|
||||
'apereo/phpcas' => array(
|
||||
'pretty_version' => '1.5.0',
|
||||
'version' => '1.5.0.0',
|
||||
'reference' => 'd6f5797fb568726f34c8e48741776d81e4a2646b',
|
||||
'pretty_version' => '1.6.0',
|
||||
'version' => '1.6.0.0',
|
||||
'reference' => 'f817c72a961484afef95ac64a9257c8e31f063b9',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../apereo/phpcas',
|
||||
'aliases' => array(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue