/**
  * Calls the authentication manager to authenticate all active tokens
  * and redirects to the original intercepted request on success if there
  * is one stored in the security context. If no intercepted request is
  * found, the function simply returns.
  *
  * If authentication fails, the result of calling the defined
  * $errorMethodName is returned.
  *
  * Note: Usually there is no need to override this action. You should use
  * the according callback methods instead (onAuthenticationSuccess() and
  * onAuthenticationFailure()).
  *
  * @return string
  *
  * @todo Make example Fluid form for Pretty Redirect Page. Maybe JS function with 5, 4, 3, 2, 1 -> redirect with fallback for non JS Browser.
  */
 public function authenticateAction()
 {
     if (!$this->request->hasArgument('casProviderName')) {
         return parent::authenticateAction();
     }
     $providerName = $this->request->getArgument('casProviderName');
     $referer = $this->catchReferer($providerName);
     if ($this->definePrettyPreRedirectTemplate($providerName)) {
         $this->view->assignMultiple(['referer' => $referer, '__casAuthenticationProviderName' => $providerName]);
     } else {
         $this->redirect('casAuthentication', null, null, ['__casAuthenticationProviderName' => $providerName]);
     }
 }
 /**
  * Overridden authenticateAction method to check for an existing account with the Opauth data.
  *
  * @return string
  */
 public function authenticateAction()
 {
     $opauthResponse = $this->opauth->getResponse();
     if ($this->authenticateActionAlreadyCalled == FALSE && $opauthResponse !== NULL) {
         $this->authenticateActionAlreadyCalled = TRUE;
         if ($opauthResponse->isAuthenticationSucceeded()) {
             $opauthAccount = $this->opauthAccountService->getAccount($opauthResponse);
             $doesAccountExists = $this->opauthAccountService->doesAccountExist($opauthAccount);
             if ($doesAccountExists === FALSE) {
                 return $this->onOpauthAccountDoesNotExist($opauthResponse->getRawData(), $opauthAccount);
             }
         } else {
             return $this->onOpauthAuthenticationFailure($opauthResponse->getRawData());
         }
     }
     return parent::authenticateAction();
 }