removed ForbiddenHttpException

Both HttpKernel and Security define a 403 exception:

* Symfony\Component\HttpKernel\Exception\ForbiddenHttpException
* Symfony\Component\Security\Exception\AccessDeniedException

The one in HttpKernel has been removed in favor of the Security one.
This commit is contained in:
Fabien Potencier 2010-12-10 09:00:06 +01:00
parent d036448542
commit 131776001f
5 changed files with 2 additions and 31 deletions

View File

@ -1,25 +0,0 @@
<?php
namespace Symfony\Component\HttpKernel\Exception;
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* ForbiddenHttpException.
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class ForbiddenHttpException extends HttpException
{
public function __construct($message = 'Forbidden', \Exception $previous = null)
{
parent::__construct($message, 403, $previous);
}
}

View File

@ -86,7 +86,7 @@ class AccessListener implements ListenerInterface
} }
if (!$this->accessDecisionManager->decide($token, $attributes, $request)) { if (!$this->accessDecisionManager->decide($token, $attributes, $request)) {
throw new AccessDeniedException('Access is denied.'); throw new AccessDeniedException();
} }
} }
} }

View File

@ -3,8 +3,6 @@
namespace Symfony\Component\Security\Authorization; namespace Symfony\Component\Security\Authorization;
use Symfony\Component\Security\Authentication\Token\TokenInterface; use Symfony\Component\Security\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Exception\AccessDeniedException;
use Symfony\Component\Security\Exception\InsufficientAuthenticationException;
/* /*
* This file is part of the Symfony package. * This file is part of the Symfony package.

View File

@ -18,7 +18,7 @@ namespace Symfony\Component\Security\Exception;
*/ */
class AccessDeniedException extends \RuntimeException class AccessDeniedException extends \RuntimeException
{ {
public function __construct($message = '', $code = 403, \Exception $previous = null) public function __construct($message = 'Access Denied', \Exception $previous = null)
{ {
parent::__construct($message, 403, $previous); parent::__construct($message, 403, $previous);
} }

View File

@ -3,8 +3,6 @@
namespace Symfony\Component\Security\User; namespace Symfony\Component\Security\User;
use Symfony\Component\Security\Exception\UsernameNotFoundException; use Symfony\Component\Security\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Exception\AccessDeniedException;
use Symfony\Component\Security\Authentication\Token\UsernamePasswordToken;
/* /*
* This file is part of the Symfony package. * This file is part of the Symfony package.