/**
  * This method writes in CasManager referer request in session because redirecting to cas server is this referer lost.
  *
  * You can get latest referer before redurect as follows: $this->casManager->getMiscellaneousByPath($providerName . '.beforeRedirectRefererUri');
  *
  * @param string $providerName
  *
  * @return \TYPO3\Flow\Http\Uri
  *
  * @todo skip this step if currentRequest === refererRequest
  */
 private function catchReferer($providerName)
 {
     if (!$this->request->getHttpRequest()->getHeaders()->has('Referer') || !$this->request->getHttpRequest()->getHeaders()->has('Host')) {
         return;
     }
     $hostName = $this->request->getHttpRequest()->getHeaders()->get('Host');
     $referer = $this->request->getHttpRequest()->getHeaders()->get('Referer');
     $refererUri = new \TYPO3\Flow\Http\Uri($referer);
     $fragment = $this->request->getInternalArgument('__fragment');
     if (!empty($fragment) && is_string($fragment)) {
         $refererUri->setFragment($fragment);
     }
     if ($refererUri->getHost() === $hostName) {
         $this->casManager->setMiscellaneousByPath($providerName . '.beforeRedirectRefererUri', $refererUri);
         return $referer;
     }
     return;
 }
示例#2
0
 /**
  * If Action for new users is defined and new user is detected, then makes this method redirect to defined Action and breaks authentication.
  *
  * You must persist new user self and afterwards authenticate this user by calling $this->casManager->authenticateNewUser($providerName).
  *
  * @param string  $providerName
  * @param Account $account
  *
  * @throws StopActionException
  *
  * @return void
  */
 private function mekeRedirectByNewUserIfNeeded($providerName, Account $account)
 {
     $redirectControllerAndAction = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow.security.authentication.providers.' . $providerName . '.providerOptions.Mapping.redirectByNewUser');
     if (!empty($redirectControllerAndAction)) {
         $this->casManager->setMiscellaneousByPath($providerName . '.Account', $account);
         $this->fixWhiteScreenByAbortingAuthentication($providerName);
         throw new StopActionException('New user detectded.', 1375270925);
     }
 }