You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UnauthorizedHttpException.php 1.1KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\web;
  8. /**
  9. * UnauthorizedHttpException represents an "Unauthorized" HTTP exception with status code 401
  10. *
  11. * Use this exception to indicate that a client needs to authenticate or login
  12. * to perform the requested action. If the client is already authenticated and
  13. * is simply not allowed to perform the action, consider using a 403
  14. * [[ForbiddenHttpException]] or 404 [[NotFoundHttpException]] instead.
  15. *
  16. * @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2
  17. * @author Dan Schmidt <danschmidt5189@gmail.com>
  18. * @since 2.0
  19. */
  20. class UnauthorizedHttpException extends HttpException
  21. {
  22. /**
  23. * Constructor.
  24. * @param string $message error message
  25. * @param integer $code error code
  26. * @param \Exception $previous The previous exception used for the exception chaining.
  27. */
  28. public function __construct($message = null, $code = 0, \Exception $previous = null)
  29. {
  30. parent::__construct(401, $message, $code, $previous);
  31. }
  32. }