/**
  *  Return Unauthorized 401
  * 
  */
 public function unauthorized()
 {
     $UE = new UnauthorizedException("You are not logged in");
     $UE->responseHeader('Access-Control-Allow-Origin', $this->request->header('Origin'));
     throw $UE;
 }
Esempio n. 2
0
 /**
  * Handles an unauthenticated access attempt by sending appropriate login headers
  *
  * @param \Cake\Network\Request $request A request object.
  * @param \Cake\Network\Response $response A response object.
  * @return void
  * @throws \Cake\Network\Exception\UnauthorizedException
  */
 public function unauthenticated(Request $request, Response $response)
 {
     $Exception = new UnauthorizedException();
     $Exception->responseHeader([$this->loginHeaders($request)]);
     throw $Exception;
 }