Skip to content

Commit

Permalink
Move cas_client_service split from config.php into CasManager::ParseC…
Browse files Browse the repository at this point in the history
…onfig

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.
  • Loading branch information
tepeds committed Sep 4, 2024
1 parent 2aed83b commit b498879
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/Subfission/Cas/CasManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),


/*
Expand Down

0 comments on commit b498879

Please sign in to comment.