/**
  * This is called when an interactive authentication attempt fails. This is
  * called by authentication listeners inheriting from
  * AbstractAuthenticationListener.
  *
  * @param Request                 $request
  * @param AuthenticationException $exception    
  * @return Response the response to return
  */
 public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
 {
     if ($request->isXmlHttpRequest()) {
         $result = array('success' => false, 'message' => $exception->getMessage());
         $response = new Response(json_encode($result));
         $response->headers->set('Content-Type', 'application/json');
         return $response;
     } else {
         echo "Not allowed";
     }
 }
 public function __construct($message, $code = 0, \Exception $previous = null)
 {
     parent::__construct($message, null, $code, $previous);
 }
 public function __construct($message, $missingScope, ResponseInterface $response)
 {
     $this->missingScope = $missingScope;
     parent::__construct($message, $response);
 }
 public function testAuthenticationException()
 {
     $e = new AuthenticationException("This is a message for users.", "This is a message for the log.");
     $this->assertEquals($e->getUserMessage(), "This is a message for users.");
     $this->assertEquals($e->getLogMessage(), "This is a message for the log.");
 }
 /**
  * Instantiates a new authentication exception.
  *
  * @param string $userMessage The message displayed to the user
  * @param string $logMessage  the message logged
  *
  * @return does not return a value.
  */
 public function __construct($userMessage = '', $logMessage = '')
 {
     parent::__construct($userMessage, $logMessage);
 }
 /**
  * {@inheritdoc}
  */
 public function unserialize($str)
 {
     list($this->username, $parentData) = unserialize($str);
     parent::unserialize($parentData);
 }
예제 #7
0
 public function __construct(\Exception $priorException = null, $errorDetail = '')
 {
     $this->errorDetail = $errorDetail;
     $this->priorException = $priorException;
     parent::__construct($priorException = null, $errorDetail);
 }
예제 #8
0
 /**
  * API Key Not Set Constructor.
  *
  * @param  string       $message
  * @param  int          $code
  * @param  string|null  $type
  * @param  string|null  $stripeCode
  * @param  string|null  $httpBody
  * @param  array        $jsonBody
  * @param  array        $params
  * @param  array        $headers
  */
 public function __construct($message, $code = 500, $type = 'api_error', $stripeCode = null, $httpBody = null, $jsonBody = [], $params = [], $headers = [])
 {
     $message = 'No API key provided.  (HINT: set your API key using ' . '"Stripe::setApiKey(<API-KEY>)".  You can generate API keys from ' . 'the Stripe web interface.  See https://stripe.com/api for ' . 'details, or email support@stripe.com if you have any questions.';
     parent::__construct($message, $code, $type, $stripeCode, $httpBody, $jsonBody, $params, $headers);
 }
 /**
  * {@inheritdoc}
  */
 public function unserialize($str)
 {
     list($parentData, $this->messageKey, $this->messageData) = unserialize($str);
     parent::unserialize($parentData);
 }
예제 #10
0
 public function testConstructor()
 {
     $authenticationException = new AuthenticationException(AuthenticationException::AUTHENTICATION_ERROR, ['consumer_id' => 1, 'resources' => 'record2']);
     $this->assertSame('An authentication error occurred.', $authenticationException->getMessage());
 }