From 299a320a7fe905402aea85b899dbd5a9cab9324c Mon Sep 17 00:00:00 2001 From: Thibault Dockx <thibault.dockx@fusiondirectory.org> Date: Mon, 6 Mar 2023 16:48:00 +0000 Subject: [PATCH] :sparkles: Feat(CAS) - Adds condition to use new library. New conditions added to use the CAS 1.6 library. --- include/login/class_LoginCAS.inc | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/include/login/class_LoginCAS.inc b/include/login/class_LoginCAS.inc index 9bae6a85a..462dbab91 100644 --- a/include/login/class_LoginCAS.inc +++ b/include/login/class_LoginCAS.inc @@ -39,20 +39,30 @@ class LoginCAS extends LoginMethod spl_autoload_unregister('fusiondirectory_autoload'); spl_autoload_register('fusiondirectory_autoload'); - if ($config->get_cfg_value('casVerbose') == 'TRUE') { + if ($config->get_cfg_value('CasVerbose') == 'TRUE') { phpCAS::setVerbose(TRUE); } - // Initialize phpCAS - phpCAS::client( - CAS_VERSION_2_0, - $config->get_cfg_value('casHost', 'localhost'), - (int) ($config->get_cfg_value('casPort', 443)), - $config->get_cfg_value('casContext', '') - ); + // Initialize CAS with proper library and call. + if ($config->get_cfg_value('CasLibraryBool')) { + phpCAS::client( + CAS_VERSION_2_0, + $config->get_cfg_value('CasHost', 'localhost'), + (int) ($config->get_cfg_value('CasPort', 443)), + $config->get_cfg_value('CasContext'), + $config->get_cfg_value('CasClientServiceName') + ); + } else { + phpCAS::client( + CAS_VERSION_2_0, + $config->get_cfg_value('CasHost', 'localhost'), + (int) ($config->get_cfg_value('CasPort', 443)), + $config->get_cfg_value('CasContext') + ); + } // Set the CA certificate that is the issuer of the cert - phpCAS::setCasServerCACert($config->get_cfg_value('casServerCaCertPath')); + phpCAS::setCasServerCACert($config->get_cfg_value('CasServerCaCertPath')); } /*! \brief All login steps in the right order for CAS login */ -- GitLab