From c1f31a7c7ec2d8e5b539c2f795ba44c4fc6eca4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Ducoulombier?= Date: Mon, 30 Dec 2019 18:03:47 +0100 Subject: [PATCH] support for CAS fixedServiceURL --- app/config/auth.conf.dist.php | 2 ++ main/auth/cas/cas_var.inc.php | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/config/auth.conf.dist.php b/app/config/auth.conf.dist.php index 9734eebfe5..3581716f06 100644 --- a/app/config/auth.conf.dist.php +++ b/app/config/auth.conf.dist.php @@ -120,4 +120,6 @@ $cas = [ // 'verbose' => false, // 'debug' => '/var/log/cas_debug.log', 'noCasServerValidation' => true, // set to false in production + // 'fixedServiceURL' => false, // false by default, set to either true or to the service URL string if needed + // sites might also need proxy_settings in configuration.php ]; diff --git a/main/auth/cas/cas_var.inc.php b/main/auth/cas/cas_var.inc.php index 9dfaba89da..758c1e81e8 100755 --- a/main/auth/cas/cas_var.inc.php +++ b/main/auth/cas/cas_var.inc.php @@ -47,10 +47,8 @@ if (api_is_cas_activated()) { phpCAS::setNoCasServerValidation(); } - global $_configuration; - if (is_array($_configuration) - && array_key_exists('proxy_settings', $_configuration)) { - $proxySettings = $_configuration['proxy_settings']; + $proxySettings = api_get_configuration_value('proxy_settings'); + if (false !== $proxySettings) { if (is_array($proxySettings) && array_key_exists('https', $proxySettings)) { $https = $proxySettings['https']; if (is_string($https) && !empty($https)) { @@ -58,5 +56,14 @@ if (api_is_cas_activated()) { } } } + + if (is_array($cas) && array_key_exists('fixedServiceURL', $cas)) { + $fixedServiceURL = $cas['fixedServiceURL']; + if (is_string($fixedServiceURL)) { + phpCAS::setFixedServiceURL($fixedServiceURL); + } else if (is_bool($fixedServiceURL) && $fixedServiceURL) { + phpCAS::setFixedServiceURL(api_get_configuration_value('root_web')); + } + } } }