Example #1
0
 /**
  * Process 401 Response Objects.  This will redirect the visitor to the
  * sites configured login page.
  *
  * @return Response
  */
 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;
 }
Example #2
0
 /**
  * isCurrentUserLoggedIn
  *
  * @return bool
  */
 public function isCurrentUserLoggedIn()
 {
     return $this->rcmUserService->hasIdentity();
 }