From b498879ba4a33305e3eaae68a16e3198e8863002 Mon Sep 17 00:00:00 2001 From: Dirk Tepe Date: Tue, 3 Sep 2024 20:42:18 -0400 Subject: [PATCH] Move cas_client_service split from config.php into CasManager::ParseConfig This allows us to pass a simple string into the phpCAS Client and Proxy methods, thereby avoiding autodiscovery. A comma separated list will be detected and split into an array when appropriate. --- src/Subfission/Cas/CasManager.php | 9 +++++++++ src/config/config.php | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Subfission/Cas/CasManager.php b/src/Subfission/Cas/CasManager.php index 56d87a4..9231666 100644 --- a/src/Subfission/Cas/CasManager.php +++ b/src/Subfission/Cas/CasManager.php @@ -177,6 +177,15 @@ protected function parseConfig(array $config) 'cas_real_hosts' => '', ]; + /* + * If cas_client_service is a string, see if it contains a comma and split on it. + * Only do this when it looks like we have a comma separated list. Passing in an array + * triggers autodiscovery downstream and we want to avoid that if possible. + */ + if (is_string($config['cas_client_service']) && strpos($config['cas_client_service'], ',') !== false) { + $config['cas_client_service'] = explode(',', $config['cas_client_service']); + } + $this->config = array_merge($defaults, $config); } diff --git a/src/config/config.php b/src/config/config.php index a58a98e..56b1754 100644 --- a/src/config/config.php +++ b/src/config/config.php @@ -65,7 +65,7 @@ |-------------------------------------------------------------------------- | Example: 'http://localhost', 'https://example.com:8888' */ - 'cas_client_service' => explode(',', env('CAS_CLIENT_SERVICE', 'http://localhost')), + 'cas_client_service' => env('CAS_CLIENT_SERVICE', 'http://localhost'), /*