diff --git a/library/digital_resources/StoryPlayR/Config.php b/library/digital_resources/StoryPlayR/Config.php index 63ffbf5e93ea8ac36f9728622e890b752d23fe88..f07fbadd4e3e15dc7ba73c650e52e47946b49394 100644 --- a/library/digital_resources/StoryPlayR/Config.php +++ b/library/digital_resources/StoryPlayR/Config.php @@ -54,7 +54,7 @@ class StoryPlayR_Config extends Class_DigitalResource_Config { return ''; return $this->getAdminVar('SSO_URL') - . '?' + . '?target=/bibliotheque&' . $this->_getSsoQuery($user); } @@ -74,9 +74,7 @@ class StoryPlayR_Config extends Class_DigitalResource_Config { public function validateUrlFor($user) { - return Class_Url::absolute(['module' => $this->getModuleName(), - 'controller' => 'auth', - 'action' => 'validate'], null, true) + return $this->_validateUrl() . '?' . http_build_query(['sessionid' => (new Class_CasTicket())->getTicketForUser($user)]); } @@ -96,9 +94,17 @@ class StoryPlayR_Config extends Class_DigitalResource_Config { protected function _getSsoQuery($user) { return $user - ? http_build_query(['userid' => $user->getLogin(), - 'mediathequeid' => $this->getAdminVar('MEDIATHEQUE_ID'), - 'sessionid' => (new Class_CasTicket())->getTicketForUser($user)]) + ? (http_build_query(['userid' => $user->getLogin(), + 'mediathequeid' => $this->getAdminVar('MEDIATHEQUE_ID'), + 'sessionid' => (new Class_CasTicket())->getTicketForUser($user)]) + . '&check_url=' . $this->_validateUrl()) : ''; } + + + protected function _validateUrl() { + return Class_Url::absolute(['module' => $this->getModuleName(), + 'controller' => 'auth', + 'action' => 'validate'], null, true); + } } \ No newline at end of file diff --git a/library/digital_resources/StoryPlayR/tests/StoryPlayRTest.php b/library/digital_resources/StoryPlayR/tests/StoryPlayRTest.php index fe51eea85ebfa9b5879792261b859396bc9cd693..7ca6b3280941c539dc2119e04d2a99e791b3809b 100644 --- a/library/digital_resources/StoryPlayR/tests/StoryPlayRTest.php +++ b/library/digital_resources/StoryPlayR/tests/StoryPlayRTest.php @@ -26,7 +26,7 @@ class StoryPlayRActivatedTestCase extends AbstractControllerTestCase { public function setUp() { parent::setUp(); - Class_AdminVar::set('StoryPlayR_SSO_URL', 'https://www.storyplayr.com/api/assa/login'); + Class_AdminVar::set('StoryPlayR_SSO_URL', 'https://www.storyplayr.com/api/bokeh/login'); Class_AdminVar::set('StoryPlayR_MEDIATHEQUE_ID', 123456); $group = $this->fixture('Class_UserGroup', @@ -59,7 +59,13 @@ class StoryPlayRSsoTest extends StoryPlayRActivatedTestCase { /** @test */ public function shouldRedirectToStoryPlayer() { - $this->assertXPathContentContains('//script' , 'document.location.href="https://www.storyplayr.com/api/assa/login?userid=Tom&mediathequeid=123456&sessionid=ST-', $this->_response->getBody()); + $this->assertXPathContentContains('//script' , 'document.location.href="https://www.storyplayr.com/api/bokeh/login?target=/bibliotheque&userid=Tom&mediathequeid=123456&sessionid=ST-', $this->_response->getBody()); + } + + + /** @test */ + public function scriptShouldContainsCheckUrl() { + $this->assertXPathContentContains('//script' , '&check_url=http://localhost/ghislo/StoryPlayR_Plugin/auth/validate', $this->_response->getBody()); } }