Ejemplo n.º 1
0
 /**
  * Entrypoint of every tool
  */
 public function launch()
 {
     try {
         taoLti_models_classes_LtiService::singleton()->startLtiSession(common_http_Request::currentRequest());
         // check if cookie has been set
         if (tao_models_classes_accessControl_AclProxy::hasAccess('verifyCookie', 'CookieUtils', 'taoLti')) {
             $this->redirect(_url('verifyCookie', 'CookieUtils', 'taoLti', array('session' => session_id(), 'redirect' => _url('run', null, null, $_GET))));
         } else {
             $this->returnError(__('You are not authorized to use this system'));
         }
     } catch (common_user_auth_AuthFailedException $e) {
         common_Logger::i($e->getMessage());
         $this->returnError(__('The LTI connection could not be established'), false);
     } catch (taoLti_models_classes_LtiException $e) {
         // In regard of the IMS LTI standard, we have to show a back button that refer to the
         // launch_presentation_return_url url param. So we have to retrieve this parameter before trying to start
         // the session
         $params = common_http_Request::currentRequest()->getParams();
         if (isset($params[taoLti_models_classes_LtiLaunchData::TOOL_CONSUMER_INSTANCE_NAME])) {
             $this->setData('consumerLabel', $params[taoLti_models_classes_LtiLaunchData::TOOL_CONSUMER_INSTANCE_NAME]);
         } elseif (isset($params[taoLti_models_classes_LtiLaunchData::TOOL_CONSUMER_INSTANCE_DESCRIPTION])) {
             $this->setData('consumerLabel', $params[taoLti_models_classes_LtiLaunchData::TOOL_CONSUMER_INSTANCE_DESCRIPTION]);
         }
         if (isset($params[taoLti_models_classes_LtiLaunchData::LAUNCH_PRESENTATION_RETURN_URL])) {
             $this->setData('returnUrl', $params[taoLti_models_classes_LtiLaunchData::LAUNCH_PRESENTATION_RETURN_URL]);
         }
         common_Logger::i($e->getMessage());
         $this->returnError(__('The LTI connection could not be established'), false);
     } catch (tao_models_classes_oauth_Exception $e) {
         common_Logger::i($e->getMessage());
         $this->returnError(__('The LTI connection could not be established'), false);
     }
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     parent::__construct();
     $authAdapter = new tao_models_classes_HttpBasicAuthAdapter(common_http_Request::currentRequest());
     try {
         $user = $authAdapter->authenticate();
         $session = new common_session_RestSession($user);
         \common_session_SessionManager::startSession($session);
     } catch (common_user_auth_AuthFailedException $e) {
         $this->requireLogin();
     }
     /*
     	    $this->headers = tao_helpers_Http::getHeaders();
     	    $this->files = tao_helpers_Http::getFiles();
     */
     if ($this->hasHeader("Accept")) {
         try {
             $this->responseEncoding = tao_helpers_Http::acceptHeader($this->acceptedMimeTypes, $this->getHeader("Accept"));
         } catch (common_exception_ClientException $e) {
             $this->returnFailure($e);
         }
     }
     if ($this->hasHeader("Accept-Language")) {
         try {
         } catch (common_exception_ClientException $e) {
             $this->returnFailure($e);
         }
     }
     header('Content-Type: ' . $this->responseEncoding);
     //check auth method requested
     /**/
 }
Ejemplo n.º 3
0
 /**
  * @deprecated use \oat\tao\model\requiredAction\implementation\RequiredActionRedirectUrlPart instead
  *
  * Execute an action
  * @param array $params
  * @return mixed
  */
 public function execute(array $params = [])
 {
     $context = \Context::getInstance();
     $excludedRoutes = $this->getExcludedRoutes();
     $currentRoute = ['extension' => $context->getExtensionName(), 'module' => $context->getModuleName(), 'action' => $context->getActionName()];
     if (!in_array($currentRoute, $excludedRoutes)) {
         $currentUrl = \common_http_Request::currentRequest()->getUrl();
         $url = $this->url . (parse_url($this->url, PHP_URL_QUERY) ? '&' : '?') . 'return_url=' . urlencode($currentUrl);
         $flowController = new FlowController();
         $flowController->redirect($url);
     }
 }
Ejemplo n.º 4
0
 /**
  *  Start the MVC Loop from the ClearFW
  *  @throws ActionEnforcingException in case of wrong module or action
  *  @throws tao_models_classes_UserException when a request try to acces a protected area
  */
 protected function mvc()
 {
     $re = \common_http_Request::currentRequest();
     $fc = new TaoFrontController();
     $fc->legacy($re);
 }
Ejemplo n.º 5
0
 public function __invoke(ServerRequestInterface $request, ResponseInterface $response)
 {
     $request->getUri();
     $pRequest = \common_http_Request::currentRequest();
     $this->legacy($pRequest, $response);
 }