diff --git a/components/ILIAS/LTIProvider/classes/InternalProvider/class.ilAuthProviderLTI.php b/components/ILIAS/LTIProvider/classes/InternalProvider/class.ilAuthProviderLTI.php index 46903c538604..99a2ee228539 100644 --- a/components/ILIAS/LTIProvider/classes/InternalProvider/class.ilAuthProviderLTI.php +++ b/components/ILIAS/LTIProvider/classes/InternalProvider/class.ilAuthProviderLTI.php @@ -255,7 +255,7 @@ public function doAuthentication(\ilAuthStatus $status): bool $lti_provider->rsaKey = $pk['key']; $lti_provider->kid = $pk['kid']; $lti_provider->signatureMethod = 'RS256'; - $lti_provider->handleRequest(); + $lti_provider->processRequest(); $this->provider = $lti_provider; $this->messageParameters = $this->provider->getMessageParameters(); diff --git a/components/ILIAS/LTIProvider/classes/InternalProvider/class.ilLTIExitException.php b/components/ILIAS/LTIProvider/classes/InternalProvider/class.ilLTIExitException.php new file mode 100644 index 000000000000..81c72f0fb5be --- /dev/null +++ b/components/ILIAS/LTIProvider/classes/InternalProvider/class.ilLTIExitException.php @@ -0,0 +1,35 @@ +onExitExceptionClass = ilLTIExitException::class; + + try { + $this->handleRequest(); + } catch (ilLTIExitException $e) { + $this->sendPendingResponse(); + } + } + + /** + * Send whatever the LTI library prepared for the platform before it tried to end the request. + * + * A redirect back to the platform carries an error message, an output body is either an error + * page or one of the self submitting forms used for the browser storage and cookie checks. A + * successfully processed launch leaves both of them empty, which is the only case where the + * control flow returns to ILIAS. + */ + private function sendPendingResponse(): void + { + if (!is_null($this->redirectUrl)) { + Util::redirect($this->redirectUrl); + } + + if (!is_null($this->output)) { + echo $this->output; + exit; + } } }