public function redirectToLogin()
 {
     $entryPointFound = FALSE;
     foreach ($this->securityContext->getAuthenticationTokens() as $token) {
         if (!is_object($token)) {
             continue;
         }
         $entryPoint = $token->getAuthenticationEntryPoint();
         if ($entryPoint !== NULL && $entryPoint->canForward($this->request)) {
             $entryPointFound = TRUE;
             if ($entryPoint instanceof \TYPO3\FLOW3\Security\Authentication\EntryPoint\WebRedirect) {
                 $options = $entryPoint->getOptions();
                 $options['uri'] = $options['uri'] . "?_redirect=" . urlencode($this->request->getRequestUri());
                 $entryPoint->setOptions($options);
                 $this->securityLogger->log('Redirecting to authentication entry point with URI ' . (isset($options['uri']) ? $options['uri'] : '- undefined -'), LOG_INFO);
             } else {
                 $this->securityLogger->log('Starting authentication with entry point of type ' . get_class($entryPoint), LOG_INFO);
             }
             $rootRequest = $this->request;
             if ($this->request instanceof \TYPO3\FLOW3\MVC\Web\SubRequest) {
                 $rootRequest = $this->request->getRootRequest();
             }
             $this->securityContext->setInterceptedRequest($rootRequest);
             $entryPoint->startAuthentication($rootRequest, $this->response);
             throw new \TYPO3\FLOW3\MVC\Exception\StopActionException();
         }
     }
     if ($entryPointFound === FALSE) {
         $this->securityLogger->log('No authentication entry point found for active tokens, therefore cannot authenticate or redirect to authentication automatically.', LOG_NOTICE);
         throw new \TYPO3\FLOW3\Security\Exception\AuthenticationRequiredException('No authentication entry point found for active tokens, therefore cannot authenticate or redirect to authentication automatically.', 1317309673);
     }
 }