diff --git a/VERSIONS_HOTLINE/182813 b/VERSIONS_HOTLINE/182813 new file mode 100644 index 0000000000000000000000000000000000000000..f922866a37318bc4192fba0c0a6afb33cb30467d --- /dev/null +++ b/VERSIONS_HOTLINE/182813 @@ -0,0 +1 @@ + - correctif #182813 : Orphée : L'utilisation du webservice Orphée peut maintenant fonctionner avec un certificat autosigné. \ No newline at end of file diff --git a/cosmogramme/php/fonctions/objets_saisie.php b/cosmogramme/php/fonctions/objets_saisie.php index bec7aeeadc97386fd81c2d010cb55f762bdb07e1..150ecafb54aa78c4b5ea325b98236c6553c96175 100644 --- a/cosmogramme/php/fonctions/objets_saisie.php +++ b/cosmogramme/php/fonctions/objets_saisie.php @@ -126,7 +126,8 @@ function getBlocsParams($id_bib, $type, $valeurs) { $valeur, ['' => 'Au titre', '1' => 'A l\'exemplaire']); - }]]; + }], + ['allow_self_signed_certificate' => fn( $id, $value) => getOuiNon($id, $value)]]; if ($clef == Class_IntBib::COM_KOHA) $champs_params[0] = ['url_serveur', diff --git a/library/Class/WebService/SIGB/Orphee.php b/library/Class/WebService/SIGB/Orphee.php index 7f4408e8e25b24346adb7b9e7f22e512f463c569..9e99205924412dec62d56407b5c11a7c892808ea 100644 --- a/library/Class/WebService/SIGB/Orphee.php +++ b/library/Class/WebService/SIGB/Orphee.php @@ -34,7 +34,8 @@ class Class_WebService_SIGB_Orphee { $service = Class_WebService_SIGB_Orphee_Service::getService($params['url_serveur'], $params['key'] ?? null, - $params['allow_hold_available_items'] ?? null); + $params['allow_hold_available_items'] ?? null, + $params['allow_self_signed_certificate'] ?? false); return static::$_services[$key] = static::_updateParams($service, $params); } diff --git a/library/Class/WebService/SIGB/Orphee/Service.php b/library/Class/WebService/SIGB/Orphee/Service.php index 9a9c8de213a8916df66ac54dab3ca6d0446345ca..d3f91ddcd7fdd4fbadf1037f554eb92bd8ef5bd2 100644 --- a/library/Class/WebService/SIGB/Orphee/Service.php +++ b/library/Class/WebService/SIGB/Orphee/Service.php @@ -35,11 +35,18 @@ class Class_WebService_SIGB_Orphee_Service extends Class_WebService_SIGB_Abstrac ; - public static function getService($wsdl, $key=null, $allow_hold_available_items=null) { + public static function getService($wsdl, $key=null, $allow_hold_available_items=null, $allow_self_signed = false) { + $soap_options =['features' => SOAP_SINGLE_ELEMENT_ARRAYS, + 'cache_wsdl' => WSDL_CACHE_BOTH, + 'trace' => false]; + + if ($allow_self_signed) + // allow Self Signed server certificate + $soap_options['stream_context']= + stream_context_create(['ssl' => ['allow_self_signed' => true]]); + return new self($wsdl, $key, $allow_hold_available_items, - ['features' => SOAP_SINGLE_ELEMENT_ARRAYS, - 'cache_wsdl' => WSDL_CACHE_BOTH, - 'trace' => false]); + $soap_options); } @@ -122,6 +129,12 @@ class Class_WebService_SIGB_Orphee_Service extends Class_WebService_SIGB_Abstrac } + /** @category testing */ + public function getSoapOptions() : array { + return $this->_soap_options ?? []; + } + + public function getSessionStrategy() { if (null === $this->_session_strategy) { $this->_session_strategy = Class_WebService_SIGB_Orphee_SessionStrategy::newFrom($this->getSearchClient(), diff --git a/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php b/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php index e8fe47020d2b87e5841fb54caced06ecd9aba0d1..0bd31052fd9760e0e0aa8f8ec10ed070a811f6e8 100644 --- a/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php +++ b/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php @@ -95,6 +95,16 @@ class OrpheeServiceGetServiceTest extends ModelTestCase { } + /** @test */ + public function serviceWithParamAllowSelfSignedCertificatShouldAddStreamContextEntryToSoapOptions() { + $orphee = Class_WebService_SIGB_Orphee::getService(['url_serveur' => 'tests/fixtures/orphee.wsdl', + 'allow_hold_available_items' => 0, + 'hold_mode' => '1', + 'allow_self_signed_certificate' => true]); + $this->assertTrue(isset($orphee->getSoapOptions()['stream_context'])); + } + + public function tearDown() { Class_WebService_SIGB_Orphee::reset(); parent::tearDown();