protected function processNotAuthorized()
    {
        $loginPage = $this->currentSite->getLoginPage();
        $notAuthorized = $this->currentSite->getNotAuthorizedPage();
        $returnToUrl = urlencode($this->request->getServer('REQUEST_URI'));
        $newResponse = new Response();
        $newResponse->setStatusCode('302');

        if (!$this->userService->hasIdentity()) {
            $newResponse->getHeaders()
                ->addHeaderLine(
                    'Location: ' . $loginPage . '?redirect=' . $returnToUrl
                );
        } else {
            $newResponse->getHeaders()
                ->addHeaderLine(
                    'Location: ' . $notAuthorized
                );
        }

        return $newResponse;
    }
protected function processNotAuthorized()
    {
        $loginPage = $this->currentSite->getLoginPage();
        $notAuthorized = $this->currentSite->getNotAuthorizedPage();
        $returnToUrl = urlencode($this->request->getServer('REQUEST_URI'));
        $newResponse = new Response();
        $newResponse->setStatusCode('302');

        if (!$this->userService->hasIdentity()) {
            $newResponse->getHeaders()
                ->addHeaderLine(
                    'Location: ' . $loginPage . '?redirect=' . $returnToUrl
                );
        } else {
            $newResponse->getHeaders()
                ->addHeaderLine(
                    'Location: ' . $notAuthorized
                );
        }

        return $newResponse;
    }
protected function processNotAuthorized ( ) { $ loginPage = $ this -> currentSite -> getLoginPage ( ) ; $ notAuthorized = $ this -> currentSite -> getNotAuthorizedPage ( ) ; $ returnToUrl = urlencode ( $ this -> request -> getServer ( 'REQUEST_URI' ) ) ; $ newResponse = new Response ( ) ; $ newResponse -> setStatusCode ( '302' ) ; if ( ! $ this -> userService -> hasIdentity ( ) ) { $ newResponse -> getHeaders ( ) -> addHeaderLine ( 'Location: ' . $ loginPage . '?redirect=' . $ returnToUrl ) ; } else { $ newResponse -> getHeaders ( ) -> addHeaderLine ( 'Location: ' . $ notAuthorized ) ; } return $ newResponse ; }
Process 401 Response Objects.  This will redirect the visitor to the
sites configured login page.

@return Response
Process 401 Response Objects . This will redirect the visitor to the sites configured login page .