From 9e1613ca0af8d995e96ef69e02d143cf118bbe49 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Tue, 15 Jun 2021 08:42:54 -0500 Subject: [PATCH] Make EBSCO URLs configurable; fix defaults for HTTPS compatibility. (#1983) --- config/vufind/EDS.ini | 6 ++++++ config/vufind/EIT.ini | 5 ++++- .../src/VuFind/Search/Factory/EITBackendFactory.php | 3 ++- .../src/VuFind/Search/Factory/EdsBackendFactory.php | 6 ++++++ module/VuFindSearch/src/VuFindSearch/Backend/EDS/Base.php | 8 +++++++- 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/config/vufind/EDS.ini b/config/vufind/EDS.ini index 45b71bc3935..68ff5de78fa 100644 --- a/config/vufind/EDS.ini +++ b/config/vufind/EDS.ini @@ -48,6 +48,12 @@ timeout = 120 ; limits that do not affect the POST-based API. search_http_method = POST +; This is the URL of the EDS API endpoint: +api_url = "https://eds-api.ebscohost.com/edsapi/rest" + +; This is the URL of the EBSCO authorization endpoint: +auth_url = "https://eds-api.ebscohost.com/authservice/rest" + ; The following two sections can be used to associate specific recommendations ; modules with specific search types defined in the [Basic_Searches] section ; below. For all the details on how these sections work, see the comments above diff --git a/config/vufind/EIT.ini b/config/vufind/EIT.ini index a7226ae04a9..f3d1c69038d 100644 --- a/config/vufind/EIT.ini +++ b/config/vufind/EIT.ini @@ -1,7 +1,7 @@ ; This section contains global settings affecting search behavior. [General] ; EBSCO offers searching via the EBSCOhost API. See the API -; documentation (http://support.ebsco.com/eit/ws.php) for more information. +; documentation (https://support.ebsco.com/eit/ws.php) for more information. ; "prof" is your profile ID; "pwd" is the password associated with that profile; ; "dbs" is a comma-separated list of three-character codes for EBSCO databases ; to which your institution subscribes and for which access is available via the @@ -19,6 +19,9 @@ prof = prof.prof.prof pwd = password dbs = aph,reh,ehh,etc +; This is the EIT API base URL: +base_url = "https://eit.ebscohost.com/Services/SearchService.asmx/Search" + ; This setting controls the default sort order of search results; the selected ; option should be one of the options present in the [Sorting] section below. default_sort = relevance diff --git a/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php index f8d197688f4..659f76c3706 100644 --- a/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/EITBackendFactory.php @@ -119,7 +119,8 @@ class EITBackendFactory implements FactoryInterface { $prof = $this->config->General->prof ?? null; $pwd = $this->config->General->pwd ?? null; - $base = "http://eit.ebscohost.com/Services/SearchService.asmx/Search"; + $base = $this->config->General->base_url + ?? 'https://eit.ebscohost.com/Services/SearchService.asmx/Search'; $dbs = $this->config->General->dbs ?? null; $client = $this->serviceLocator->get(\VuFindHttp\HttpService::class) ->createClient(); diff --git a/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php index 4dcbac08534..9f7651194e8 100644 --- a/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php +++ b/module/VuFind/src/VuFind/Search/Factory/EdsBackendFactory.php @@ -141,6 +141,12 @@ class EdsBackendFactory implements FactoryInterface 'search_http_method' => $this->edsConfig->General->search_http_method ?? 'POST' ]; + if (isset($this->edsConfig->General->api_url)) { + $options['api_url'] = $this->edsConfig->General->api_url; + } + if (isset($this->edsConfig->General->auth_url)) { + $options['auth_url'] = $this->edsConfig->General->auth_url; + } // Build HTTP client: $client = $this->serviceLocator->get(\VuFindHttp\HttpService::class) ->createClient(); diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Base.php b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Base.php index 4dd3be3a6fd..97a3a78e867 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Base.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Base.php @@ -51,7 +51,7 @@ abstract class Base * * @var string */ - protected $edsApiHost = 'http://eds-api.ebscohost.com/edsapi/rest'; + protected $edsApiHost = 'https://eds-api.ebscohost.com/edsapi/rest'; /** * Auth host @@ -106,6 +106,12 @@ abstract class Base if (is_array($settings)) { foreach ($settings as $key => $value) { switch ($key) { + case 'api_url': + $this->edsApiHost = $value; + break; + case 'auth_url': + $this->authHost = $value; + break; case 'debug': $this->debug = $value; break; -- GitLab