diff --git a/module/VuFind/src/VuFind/Auth/AbstractBase.php b/module/VuFind/src/VuFind/Auth/AbstractBase.php index 22a4e82e4866..265127dab0d3 100644 --- a/module/VuFind/src/VuFind/Auth/AbstractBase.php +++ b/module/VuFind/src/VuFind/Auth/AbstractBase.php @@ -70,7 +70,7 @@ abstract class AbstractBase implements /** * Configuration settings. * - * @var \VuFind\Config\Config + * @var ?array */ protected $config = null; @@ -101,7 +101,7 @@ abstract class AbstractBase implements * exception if the configuration is invalid. * * @throws AuthException - * @return \VuFind\Config\Config + * @return ?array */ public function getConfig() { @@ -145,7 +145,7 @@ public function clearLoginState() /** * Set configuration. * - * @param \VuFind\Config\Config $config Configuration to set + * @param ?array $config Configuration to set * * @return void */ @@ -450,9 +450,7 @@ public function getPolicyConfig(string $type): array { $policy = []; $config = $this->getConfig(); - $authConfig = isset($config->Authentication) - ? $config->Authentication->toArray() - : []; + $authConfig = $config['Authentication'] ?? []; /* Map settings to the policy array, e.g.: * * password_minimum_length or username_minimum_length => minLength diff --git a/module/VuFind/src/VuFind/Auth/AlmaDatabase.php b/module/VuFind/src/VuFind/Auth/AlmaDatabase.php index 5ba0abe2330d..de595c9e8cd2 100644 --- a/module/VuFind/src/VuFind/Auth/AlmaDatabase.php +++ b/module/VuFind/src/VuFind/Auth/AlmaDatabase.php @@ -88,7 +88,7 @@ public function create($request) { // When in privacy mode, don't create an Alma account and delegate // further code execution to the parent. - if ($this->getConfig()->Authentication->privacy) { + if ($this->getConfig()['Authentication']['privacy'] ?? null) { return parent::create($request); } diff --git a/module/VuFind/src/VuFind/Auth/AuthInterface.php b/module/VuFind/src/VuFind/Auth/AuthInterface.php index b3462534d719..d9914bab3e64 100644 --- a/module/VuFind/src/VuFind/Auth/AuthInterface.php +++ b/module/VuFind/src/VuFind/Auth/AuthInterface.php @@ -71,7 +71,7 @@ public function clearLoginState(); /** * Set configuration. * - * @param \VuFind\Config\Config $config Configuration to set + * @param ?array $config Configuration to set * * @return void */ diff --git a/module/VuFind/src/VuFind/Auth/CAS.php b/module/VuFind/src/VuFind/Auth/CAS.php index fdbba6b2fbd4..17bb4a68e3c5 100644 --- a/module/VuFind/src/VuFind/Auth/CAS.php +++ b/module/VuFind/src/VuFind/Auth/CAS.php @@ -79,44 +79,44 @@ public function __construct(protected ILSAuthenticator $ilsAuthenticator) */ protected function validateConfig() { - $cas = $this->config->CAS; + $cas = $this->config['CAS'] ?? []; // Throw an exception if the required server setting is missing. - if (!isset($cas->server)) { + if (!isset($cas['server'])) { throw new AuthException( 'CAS server configuration parameter is not set.' ); } // Throw an exception if the required port setting is missing. - if (!isset($cas->port)) { + if (!isset($cas['port'])) { throw new AuthException( 'CAS port configuration parameter is not set.' ); } // Throw an exception if the required context setting is missing. - if (!isset($cas->context)) { + if (!isset($cas['context'])) { throw new AuthException( 'CAS context configuration parameter is not set.' ); } // Throw an exception if the required CACert setting is missing. - if (!isset($cas->CACert)) { + if (!isset($cas['CACert'])) { throw new AuthException( 'CAS CACert configuration parameter is not set.' ); } // Throw an exception if the required login setting is missing. - if (!isset($cas->login)) { + if (!isset($cas['login'])) { throw new AuthException( 'CAS login configuration parameter is not set.' ); } // Throw an exception if the required logout setting is missing. - if (!isset($cas->logout)) { + if (!isset($cas['logout'])) { throw new AuthException( 'CAS logout configuration parameter is not set.' ); @@ -135,13 +135,13 @@ protected function validateConfig() public function authenticate($request) { // Configure phpCAS - $cas = $this->getConfig()->CAS; + $cas = $this->getConfig()['CAS']; $casauth = $this->setupCAS(); $casauth->forceAuthentication(); // Check if username is set. - if (isset($cas->username) && !empty($cas->username)) { - $username = $casauth->getAttribute($cas->username); + if (!empty($cas['username'])) { + $username = $casauth->getAttribute($cas['username']); } else { $username = $casauth->getUser(); } @@ -160,8 +160,8 @@ public function authenticate($request) ]; $catPassword = null; foreach ($attribsToCheck as $attribute) { - if (isset($cas->$attribute)) { - $value = $casauth->getAttribute($cas->$attribute); + if (isset($cas[$attribute])) { + $value = $casauth->getAttribute($cas[$attribute]); if ($attribute == 'email') { $userService->updateUserEmail($user, $value); } elseif ($attribute != 'cat_password') { @@ -189,9 +189,9 @@ public function authenticate($request) public function getSessionInitiator(string $target): ?string { $config = $this->getConfig(); - $casTarget = $config->CAS->target ?? $target; + $casTarget = $config['CAS']['target '] ?? $target; $append = (str_contains($casTarget, '?')) ? '&' : '?'; - $sessionInitiator = $config->CAS->login + $sessionInitiator = $config['CAS']['login'] . '?service=' . urlencode($casTarget) . urlencode($append . 'auth_method=CAS'); @@ -207,8 +207,8 @@ public function isExpired() { $config = $this->getConfig(); if ( - isset($config->CAS->username) - && isset($config->CAS->logout) + isset($config['CAS']['username']) + && isset($config['CAS']['logout']) ) { $casauth = $this->setupCAS(); if ($casauth->checkAuthentication() === false) { @@ -229,8 +229,8 @@ public function getLogoutRedirectUrl(string $url): string { // If single log-out is enabled, use a special URL: $config = $this->getConfig(); - if (!empty($config->CAS->logout)) { - $url = $config->CAS->logout . '?service=' . urlencode($url); + if (!empty($config['CAS']['logout'])) { + $url = $config['CAS']['logout'] . '?service=' . urlencode($url); } // Send back the redirect URL (possibly modified): @@ -248,11 +248,11 @@ protected function getRequiredAttributes() $sortedUserAttributes = []; // Now extract user attribute values: - $cas = $this->getConfig()->CAS; + $cas = $this->getConfig()['CAS']; foreach ($cas as $key => $value) { if (preg_match('/userattribute_[0-9]{1,}/', $key)) { $valueKey = 'userattribute_value_' . substr($key, 14); - $sortedUserAttributes[$value] = $cas->$valueKey ?? null; + $sortedUserAttributes[$value] = $cas[$valueKey] ?? null; // Throw an exception if attributes are missing/empty. if (empty($sortedUserAttributes[$value])) { @@ -275,12 +275,12 @@ protected function getRequiredAttributes() protected function getServiceBaseUrl(): array { $config = $this->getConfig(); - $cas = $config->CAS; - if (isset($cas->service_base_url)) { - return $cas->service_base_url->toArray(); - } elseif (isset($config->Site->url)) { + $cas = $config['CAS']; + if (isset($cas['service_base_url'])) { + return $cas['service_base_url']; + } elseif (isset($config['Site']['url'])) { // fallback method - $siteUrl = parse_url($config->Site->url); + $siteUrl = parse_url($config['Site']['url']); if (isset($siteUrl['scheme']) && isset($siteUrl['host'])) { return [ $siteUrl['scheme'] . '://' . $siteUrl['host'] . @@ -308,27 +308,27 @@ protected function setupCAS() // Check to see if phpCAS has already been setup. If it has, than skip as // client can only be called once. if (!$this->phpCASSetup) { - $cas = $this->getConfig()->CAS; + $cas = $this->getConfig()['CAS']; $casauth->setLogger($this->logger); - if ($cas->debug ?? false) { + if ($cas['debug'] ?? false) { $casauth->setVerbose(true); } - $protocol = constant($cas->protocol ?? 'SAML_VERSION_1_1'); + $protocol = constant($cas['protocol'] ?? 'SAML_VERSION_1_1'); $casauth->client( $protocol, - $cas->server, - (int)$cas->port, - $cas->context, + $cas['server'], + (int)$cas['port'], + $cas['context'], $this->getServiceBaseUrl(), false ); - if (isset($cas->CACert) && !empty($cas->CACert)) { - $casauth->setCasServerCACert($cas->CACert); + if (!empty($cas['CACert'])) { + $casauth->setCasServerCACert($cas['CACert']); } else { $casauth->setNoCasServerValidation(); } diff --git a/module/VuFind/src/VuFind/Auth/ChoiceAuth.php b/module/VuFind/src/VuFind/Auth/ChoiceAuth.php index 6499770ffba6..ab451f6012f1 100644 --- a/module/VuFind/src/VuFind/Auth/ChoiceAuth.php +++ b/module/VuFind/src/VuFind/Auth/ChoiceAuth.php @@ -106,10 +106,7 @@ public function __construct(\Laminas\Session\Container $container) */ protected function validateConfig() { - if ( - !isset($this->config->ChoiceAuth->choice_order) - || !strlen($this->config->ChoiceAuth->choice_order) - ) { + if (!strlen($this->config['ChoiceAuth']['choice_order'] ?? '')) { throw new AuthException( 'One or more ChoiceAuth parameters are missing. ' . 'Check your config.ini!' @@ -120,7 +117,7 @@ protected function validateConfig() /** * Set configuration; throw an exception if it is invalid. * - * @param \VuFind\Config\Config $config Configuration to set + * @param ?array $config Configuration to set * * @throws AuthException * @return void @@ -130,7 +127,7 @@ public function setConfig($config) parent::setConfig($config); $this->strategies = array_map( 'trim', - explode(',', $this->getConfig()->ChoiceAuth->choice_order) + explode(',', $this->getConfig()['ChoiceAuth']['choice_order']) ); } diff --git a/module/VuFind/src/VuFind/Auth/Database.php b/module/VuFind/src/VuFind/Auth/Database.php index b5522f22f444..38d627ab98b5 100644 --- a/module/VuFind/src/VuFind/Auth/Database.php +++ b/module/VuFind/src/VuFind/Auth/Database.php @@ -126,7 +126,7 @@ public function authenticate($request) protected function passwordHashingEnabled() { $config = $this->getConfig(); - return $config->Authentication->hash_passwords ?? false; + return $config['Authentication']['hash_passwords'] ?? false; } /** @@ -275,7 +275,7 @@ protected function validatePassword($params) protected function checkEmailVerified($user) { $config = $this->getConfig(); - $verify_email = $config->Authentication->verify_email ?? false; + $verify_email = $config['Authentication']['verify_email'] ?? false; if ($verify_email && !$user->getEmailVerified()) { throw new AuthEmailNotVerifiedException( $user, @@ -322,8 +322,7 @@ protected function emailAllowed($email) { // If no inclusion list is configured, all emails are allowed: $fullConfig = $this->getConfig(); - $config = isset($fullConfig->Authentication) - ? $fullConfig->Authentication->toArray() : []; + $config = $fullConfig['Authentication'] ?? []; $rawIncludeList = $config['legal_domains'] ?? $config['domain_whitelist'] // deprecated configuration ?? null; diff --git a/module/VuFind/src/VuFind/Auth/Facebook.php b/module/VuFind/src/VuFind/Auth/Facebook.php index cf864d0e88b7..9b22358395eb 100644 --- a/module/VuFind/src/VuFind/Auth/Facebook.php +++ b/module/VuFind/src/VuFind/Auth/Facebook.php @@ -77,14 +77,14 @@ public function __construct(\Laminas\Session\Container $container) protected function validateConfig() { // Throw an exception if the required username setting is missing. - $fb = $this->config->Facebook; - if (!isset($fb->appId) || empty($fb->appId)) { + $fb = $this->config['Facebook'] ?? []; + if (empty($fb['appId'])) { throw new AuthException( 'Facebook app ID is missing in your configuration file.' ); } - if (!isset($fb->secret) || empty($fb->secret)) { + if (empty($fb['secret'])) { throw new AuthException( 'Facebook app secret is missing in your configuration file.' ); @@ -151,7 +151,7 @@ public function getSessionInitiator(string $target): ?string . 'auth_method=Facebook'; $this->session->lastUri = $target; return $base . '?client_id=' - . urlencode($this->getConfig()->Facebook->appId) + . urlencode($this->getConfig()['Facebook']['appId']) . '&redirect_uri=' . urlencode($target) . '&scope=public_profile,email'; } @@ -166,9 +166,9 @@ public function getSessionInitiator(string $target): ?string protected function getAccessTokenFromCode($code) { $requestUrl = 'https://graph.facebook.com/oauth/access_token?' - . 'client_id=' . urlencode($this->getConfig()->Facebook->appId) + . 'client_id=' . urlencode($this->getConfig()['Facebook']['appId']) . '&redirect_uri=' . urlencode($this->session->lastUri) - . '&client_secret=' . urlencode($this->getConfig()->Facebook->secret) + . '&client_secret=' . urlencode($this->getConfig()['Facebook']['secret']) . '&code=' . urlencode($code); $response = $this->httpService->get($requestUrl); $parts = explode('&', $response->getBody(), 2); diff --git a/module/VuFind/src/VuFind/Auth/ILS.php b/module/VuFind/src/VuFind/Auth/ILS.php index 7ec8af557d0f..7e7b18e315c3 100644 --- a/module/VuFind/src/VuFind/Auth/ILS.php +++ b/module/VuFind/src/VuFind/Auth/ILS.php @@ -487,6 +487,6 @@ protected function getLoggedInPatron() protected function getUsernameField() { $config = $this->getConfig(); - return $config->Authentication->ILS_username_field ?? 'cat_username'; + return $config['Authentication']['ILS_username_field'] ?? 'cat_username'; } } diff --git a/module/VuFind/src/VuFind/Auth/LDAP.php b/module/VuFind/src/VuFind/Auth/LDAP.php index 680ffa4de63e..b7415399dc89 100644 --- a/module/VuFind/src/VuFind/Auth/LDAP.php +++ b/module/VuFind/src/VuFind/Auth/LDAP.php @@ -68,9 +68,9 @@ protected function validateConfig() { // Check for missing parameters: if ( - empty($this->config->LDAP->basedn ?? '') - || empty($this->config->LDAP->username ?? '') - || empty($this->config->LDAP->uri ?? '') + empty($this->config['LDAP']['basedn']) + || empty($this->config['LDAP']['username']) + || empty($this->config['LDAP']['uri']) ) { throw new AuthException( 'One or more LDAP parameters are missing. Check your config.ini!' @@ -88,7 +88,7 @@ protected function validateConfig() protected function getSetting($name) { $config = $this->getConfig(); - $value = $config->LDAP->$name ?? ''; + $value = $config['LDAP'][$name] ?? ''; // Normalize all values to lowercase except for potentially case-sensitive // bind and basedn credentials. @@ -173,8 +173,7 @@ protected function connect() // if the uri parameter is not specified as ldaps:// // then (unless TLS is disabled) we need to initiate TLS so we // can have a secure connection over the standard LDAP port. - $disableTls = isset($this->config->LDAP->disable_tls) - && $this->config->LDAP->disable_tls; + $disableTls = $this->config['LDAP']['disable_tls'] ?? false; if (!str_starts_with($uri, 'ldaps://') && !$disableTls) { $this->debug('Starting TLS'); if (!@ldap_start_tls($connection)) { @@ -293,7 +292,7 @@ protected function processLDAPUser($username, $data) $configValue = $this->getSetting($field); if ($data[$i][$j] == $configValue && !empty($configValue)) { $value = $data[$i][$configValue]; - $separator = $this->config->LDAP->separator; + $separator = $this->config['LDAP']['separator'] ?? null; // if no separator is given map only the first value if (isset($separator)) { $tmp = []; diff --git a/module/VuFind/src/VuFind/Auth/Manager.php b/module/VuFind/src/VuFind/Auth/Manager.php index 87e61b2e6359..347488fd8b85 100644 --- a/module/VuFind/src/VuFind/Auth/Manager.php +++ b/module/VuFind/src/VuFind/Auth/Manager.php @@ -35,7 +35,6 @@ use Lmc\Rbac\Identity\IdentityInterface; use Lmc\Rbac\Mvc\Identity\IdentityProviderInterface; use Psr\Log\LoggerAwareInterface; -use VuFind\Config\Config; use VuFind\Cookie\CookieManager; use VuFind\Db\Entity\UserEntityInterface; use VuFind\Db\Service\AuditEventServiceInterface; @@ -204,7 +203,7 @@ protected function makeAuth(string $method): AuthInterface throw new \Exception("Illegal authentication method: $method"); } $auth = $this->pluginManager->get($method); - $auth->setConfig(new Config($this->config)); + $auth->setConfig($this->config); return $auth; } diff --git a/module/VuFind/src/VuFind/Auth/MultiAuth.php b/module/VuFind/src/VuFind/Auth/MultiAuth.php index b8ac52cf046b..e68000bd2ef0 100644 --- a/module/VuFind/src/VuFind/Auth/MultiAuth.php +++ b/module/VuFind/src/VuFind/Auth/MultiAuth.php @@ -115,7 +115,7 @@ class MultiAuth extends AbstractBase */ protected function validateConfig() { - if (empty($this->config->MultiAuth->method_order)) { + if (empty($this->config['MultiAuth']['method_order'])) { throw new AuthException( 'One or more MultiAuth parameters are missing. ' . 'Check your config.ini!' @@ -126,7 +126,7 @@ protected function validateConfig() /** * Set configuration; throw an exception if it is invalid. * - * @param \VuFind\Config\Config $config Configuration to set + * @param ?array $config Configuration to set * * @throws AuthException * @return void @@ -134,19 +134,16 @@ protected function validateConfig() public function setConfig($config) { parent::setConfig($config); - if (isset($config->MultiAuth->method_order)) { + if (isset($config['MultiAuth']['method_order'])) { $this->methods = array_map( 'trim', - explode(',', $config->MultiAuth->method_order) + explode(',', $config['MultiAuth']['method_order']) ); } - if ( - isset($config->MultiAuth->filters) - && strlen($config->MultiAuth->filters) - ) { + if (strlen($config['MultiAuth']['filters'] ?? '')) { $this->filters = array_map( 'trim', - explode(',', $config->MultiAuth->filters) + explode(',', $config['MultiAuth']['filters']) ); } } diff --git a/module/VuFind/src/VuFind/Auth/OpenIDConnect.php b/module/VuFind/src/VuFind/Auth/OpenIDConnect.php index 6026e5880419..6dacb45cdc7e 100644 --- a/module/VuFind/src/VuFind/Auth/OpenIDConnect.php +++ b/module/VuFind/src/VuFind/Auth/OpenIDConnect.php @@ -579,7 +579,7 @@ protected function getAttributesMappings(): array */ protected function getAttributeValue(object $userInfo, string $attribute): string { - $attributeName = $this->oidcConfig->attributes[$attribute] ?? $attribute; + $attributeName = $this->oidcConfig['attributes'][$attribute] ?? $attribute; return (string)($userInfo->attributes->$attributeName ?? $userInfo->$attributeName ?? ''); } diff --git a/module/VuFind/src/VuFind/Auth/PasswordAccess.php b/module/VuFind/src/VuFind/Auth/PasswordAccess.php index 10ac3d1d1e92..c10431677e44 100644 --- a/module/VuFind/src/VuFind/Auth/PasswordAccess.php +++ b/module/VuFind/src/VuFind/Auth/PasswordAccess.php @@ -47,24 +47,6 @@ */ class PasswordAccess extends AbstractBase { - /** - * Get configuration (load automatically if not previously set). Throw an - * exception if the configuration is invalid. - * - * @throws AuthException - * @return \VuFind\Config\Config - */ - public function getConfig() - { - // Validate configuration if not already validated: - if (!$this->configValidated) { - $this->validateConfig(); - $this->configValidated = true; - } - - return $this->config; - } - /** * Attempt to authenticate the current user. Throws exception if login fails. * @@ -76,7 +58,7 @@ public function getConfig() */ public function authenticate($request) { - $config = $this->getConfig()->toArray(); + $config = $this->getConfig(); $requestPassword = trim($request->getPost()->get('password', '')); foreach ($config['PasswordAccess']['access_user_hashed'] ?? [] as $username => $passwordHash) { if (password_verify($requestPassword, $passwordHash)) { diff --git a/module/VuFind/src/VuFind/Auth/SIP2.php b/module/VuFind/src/VuFind/Auth/SIP2.php index 765b96dcf5ba..7c2dda1cb1de 100644 --- a/module/VuFind/src/VuFind/Auth/SIP2.php +++ b/module/VuFind/src/VuFind/Auth/SIP2.php @@ -74,9 +74,9 @@ public function authenticate($request) // Attempt SIP2 Authentication $mysip = new \sip2(); $config = $this->getConfig(); - if (isset($config->SIP2)) { - $mysip->hostname = $config->SIP2->host; - $mysip->port = $config->SIP2->port; + if (isset($config['SIP2'])) { + $mysip->hostname = $config['SIP2']['host']; + $mysip->port = $config['SIP2']['port']; } if (!$mysip->connect()) { diff --git a/module/VuFind/src/VuFind/Auth/Shibboleth.php b/module/VuFind/src/VuFind/Auth/Shibboleth.php index e42e26dd05e0..e8c37c7eda5f 100644 --- a/module/VuFind/src/VuFind/Auth/Shibboleth.php +++ b/module/VuFind/src/VuFind/Auth/Shibboleth.php @@ -116,17 +116,17 @@ public function __construct( /** * Set configuration. * - * @param \VuFind\Config\Config $config Configuration to set + * @param ?array $config Configuration to set * * @return void */ public function setConfig($config) { parent::setConfig($config); - $this->useHeaders = $this->config->Shibboleth->use_headers ?? false; - $this->shibIdentityProvider = $this->config->Shibboleth->idpserverparam + $this->useHeaders = $this->config['Shibboleth']['use_headers'] ?? false; + $this->shibIdentityProvider = $this->config['Shibboleth']['idpserverparam'] ?? self::DEFAULT_IDPSERVERPARAM; - $this->shibSessionId = $this->config->Shibboleth->session_id ?? null; + $this->shibSessionId = $this->config['Shibboleth']['session_id'] ?? null; } /** @@ -140,15 +140,15 @@ public function setConfig($config) protected function validateConfig() { // Throw an exception if the required username setting is missing. - $shib = $this->config->Shibboleth; - if (!isset($shib->username) || empty($shib->username)) { + $shib = $this->config['Shibboleth'] ?? []; + if (empty([$shib['username']])) { throw new AuthException( 'Shibboleth username is missing in your configuration file.' ); } // Throw an exception if no login endpoint is available. - if (!isset($shib->login)) { + if (!isset($shib['login'])) { throw new AuthException( 'Shibboleth login configuration parameter is not set.' ); @@ -170,6 +170,10 @@ public function authenticate($request) // Check if username is set. $entityId = $this->getCurrentEntityId($request); $shib = $this->getConfigurationLoader()->getConfiguration($entityId); + if (!isset($shib['username'])) { + $this->debug('Username attribute configuration missing.'); + throw new AuthException('authentication_error_admin'); + } $username = $this->getAttribute($request, $shib['username']); if (empty($username)) { $details = ($this->useHeaders) ? $request->getHeaders()->toArray() @@ -239,17 +243,17 @@ public function authenticate($request) public function getSessionInitiator(string $target): ?string { $config = $this->getConfig(); - $shibTarget = $config->Shibboleth->target ?? $target; + $shibTarget = $config['Shibboleth']['target'] ?? $target; $append = (str_contains($shibTarget, '?')) ? '&' : '?'; // Adding the auth_method parameter makes it possible to handle logins when // using an auth method that proxies others. - $sessionInitiator = $config->Shibboleth->login + $sessionInitiator = $config['Shibboleth']['login'] . '?target=' . urlencode($shibTarget) . urlencode($append . 'auth_method=Shibboleth'); - if (isset($config->Shibboleth->provider_id)) { + if (isset($config['Shibboleth']['provider_id'])) { $sessionInitiator = $sessionInitiator . '&entityID=' . - urlencode($config->Shibboleth->provider_id); + urlencode($config['Shibboleth']['provider_id']); } return $sessionInitiator; @@ -265,7 +269,7 @@ public function isExpired() $config = $this->getConfig(); if ( !isset($this->shibSessionId) - || !($config->Shibboleth->checkExpiredSession ?? true) + || !($config['Shibboleth']['checkExpiredSession'] ?? true) ) { return false; } @@ -284,9 +288,9 @@ public function getLogoutRedirectUrl(string $url): string { // If single log-out is enabled, use a special URL: $config = $this->getConfig(); - if (!empty($config->Shibboleth->logout)) { - $append = (str_contains($config->Shibboleth->logout, '?')) ? '&' : '?'; - $url = $config->Shibboleth->logout . $append . 'return=' . urlencode($url); + if (!empty($config['Shibboleth']['logout'])) { + $append = (str_contains($config['Shibboleth']['logout'], '?')) ? '&' : '?'; + $url = $config['Shibboleth']['logout'] . $append . 'return=' . urlencode($url); } // Send back the redirect URL (possibly modified): diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/CASTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/CASTest.php index 5f7244c5f3d7..1241b2dadd73 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/CASTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/CASTest.php @@ -30,7 +30,6 @@ namespace VuFindTest\Auth; use VuFind\Auth\CAS; -use VuFind\Config\Config; /** * CAS authentication test class. @@ -55,7 +54,7 @@ class CASTest extends \PHPUnit\Framework\TestCase public function getAuthObject(?array $config = null): CAS { $obj = new CAS($this->createMock(\VuFind\Auth\ILSAuthenticator::class)); - $obj->setConfig(new Config($config ?? $this->getAuthConfig())); + $obj->setConfig($config ?? $this->getAuthConfig()); return $obj; }