From a128fcd27e587ea3da3ec7e9c8fc7aa48ae75279 Mon Sep 17 00:00:00 2001
From: Patrick Barroca <pbarroca@afi-sa.fr>
Date: Fri, 12 Jun 2020 15:41:03 +0200
Subject: [PATCH] hotline #79470 : fix new sso url

---
 VERSIONS_HOTLINE/79470                                         | 1 +
 library/digital_resources/Bibliondemand/Config.php             | 2 +-
 .../Bibliondemand/tests/BibliondemandTest.php                  | 3 ++-
 3 files changed, 4 insertions(+), 2 deletions(-)
 create mode 100644 VERSIONS_HOTLINE/79470

diff --git a/VERSIONS_HOTLINE/79470 b/VERSIONS_HOTLINE/79470
new file mode 100644
index 00000000000..4c11bd70047
--- /dev/null
+++ b/VERSIONS_HOTLINE/79470
@@ -0,0 +1 @@
+ - ticket #79470 : Ressource numériques : Mise à jour du lien SSO pour le connecteur Bibiondemand
\ No newline at end of file
diff --git a/library/digital_resources/Bibliondemand/Config.php b/library/digital_resources/Bibliondemand/Config.php
index f9c65ce68c2..244645286c4 100644
--- a/library/digital_resources/Bibliondemand/Config.php
+++ b/library/digital_resources/Bibliondemand/Config.php
@@ -61,7 +61,7 @@ class Bibliondemand_Config extends Class_DigitalResource_Config {
     $url = Class_AdminVar::getValueOrDefault($this->withNameSpace('SSO_URL'));
 
     return ($record_url = (new Class_Notice_Sso($record))->getFirstPrivateUrl())
-      ? $url . '&' . http_build_query(['returnUrl' => $record_url])
+      ? $url . '&' . http_build_query(['returnUrl' => '/sarasvati/ws/secure/redirect.ashx?url=' . $record_url])
       : $url;
   }
 
diff --git a/library/digital_resources/Bibliondemand/tests/BibliondemandTest.php b/library/digital_resources/Bibliondemand/tests/BibliondemandTest.php
index c970a01648a..1d2cb993a2f 100644
--- a/library/digital_resources/Bibliondemand/tests/BibliondemandTest.php
+++ b/library/digital_resources/Bibliondemand/tests/BibliondemandTest.php
@@ -172,7 +172,8 @@ class ModulesControllerBibliondemandSsoTest extends AbstractControllerTestCase {
   /** @test */
   public function record21ShouldRedirectToBibliondemandSso() {
     $this->dispatch('/modules/sso/id/21', true);
-    $this->assertXPathContentContains('//script', 'document.location.href="http://numerique-pasdecalais.bibliondemand.com/logon.aspx?provider=SsoCas&sso-id=cg62-saintomer&returnUrl='. urlencode('http://music.1dtouch.com/users/auth/assa?dest=albums/137962&bibid=CG62').'"', $this->_response->getBody());
+    $this->assertXPathContentContains('//script', 'document.location.href="http://numerique-pasdecalais.bibliondemand.com/logon.aspx?provider=SsoCas&sso-id=cg62-saintomer&returnUrl='. urlencode('/sarasvati/ws/secure/redirect.ashx?url=http://music.1dtouch.com/users/auth/assa?dest=albums/137962&bibid=CG62').'"',
+                                      $this->_response->getBody());
   }
 }
 
-- 
GitLab