public function LTIToolProviderController::ltiLaunch in LTI Tool Provider 8
Same name and namespace in other branches
- 2.x src/Controller/LTIToolProviderController.php \Drupal\lti_tool_provider\Controller\LTIToolProviderController::ltiLaunch()
LTI launch.
Authenticates the user via the authentication.lti_tool_provider service, login that user, and then redirect the user to the appropriate page.
This controller requires that the authentication.lti_tool_provider service is attached to this route in lti_tool_provider.routing.yml.
Return value
RedirectResponse Redirect user to appropriate LTI url.
See also
\Drupal\lti_tool_provider\Authentication\Provider\LTIToolProvider
1 string reference to 'LTIToolProviderController::ltiLaunch'
File
- src/
Controller/ LTIToolProviderController.php, line 167
Class
- LTIToolProviderController
- Returns responses for lti_tool_provider module routes.
Namespace
Drupal\lti_tool_provider\ControllerCode
public function ltiLaunch() : RedirectResponse {
try {
$destination = '/';
if (empty($this->context)) {
throw new Exception('LTI context missing.');
}
if (!empty($this->destination)) {
$destination = $this->destination;
}
if (isset($this->context['custom_destination']) && !empty($this->context['custom_destination'])) {
$destination = $this->context['custom_destination'];
}
$this->killSwitch
->trigger();
$event = new LtiToolProviderLaunchRedirectEvent($this->context, $destination);
LtiToolProviderEvent::dispatchEvent($this->eventDispatcher, $event);
if ($event
->isCancelled()) {
throw new Exception($event
->getMessage());
}
$destination = $event
->getDestination();
return new RedirectResponse($destination);
} catch (Exception $e) {
$this->loggerFactory
->warning($e
->getMessage());
return new RedirectResponse('/', 500);
}
}