public function authenticateAction()
    {
        $authenticationException = null;
        try {
            $this->authenticationManager->authenticate();
        } catch (AuthenticationRequiredException $exception) {
            $authenticationException = $exception;
        }

        if (!$this->authenticationManager->isAuthenticated()) {
            $this->onAuthenticationFailure($authenticationException);
            return call_user_func([$this, $this->errorMethodName]);
        }

        $storedRequest = $this->securityContext->getInterceptedRequest();
        if ($storedRequest !== null) {
            $this->securityContext->setInterceptedRequest(null);
        }
        return $this->onAuthenticationSuccess($storedRequest);
    }