* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Security\Http\Firewall; use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface; use Symfony\Component\Security\Http\AccessMapInterface; use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException; use Symfony\Component\Security\Core\Exception\AccessDeniedException; /** * AccessListener enforces access control rules. * * @author Fabien Potencier */ class AccessListener implements ListenerInterface { private $tokenStorage; private $accessDecisionManager; private $map; private $authManager; public function __construct(TokenStorageInterface $tokenStorage, AccessDecisionManagerInterface $accessDecisionManager, AccessMapInterface $map, AuthenticationManagerInterface $authManager) { $this->tokenStorage = $tokenStorage; $this->accessDecisionManager = $accessDecisionManager; $this->map = $map; $this->authManager = $authManager; } /** * Handles access authorization. * * @throws AccessDeniedException * @throws AuthenticationCredentialsNotFoundException */ public function handle(GetResponseEvent $event) { if (null === $token = $this->tokenStorage->getToken()) { throw new AuthenticationCredentialsNotFoundException('A Token was not found in the TokenStorage.'); } $request = $event->getRequest(); list($attributes) = $this->map->getPatterns($request); if (null === $attributes) { return; } if (!$token->isAuthenticated()) { $token = $this->authManager->authenticate($token); $this->tokenStorage->setToken($token); } if (!$this->accessDecisionManager->decide($token, $attributes, $request)) { $exception = new AccessDeniedException(); $exception->setAttributes($attributes); $exception->setSubject($request); throw $exception; } } } __halt_compiler();----SIGNATURE:----I++Eu7cMyUUI1YfmacHVh6J0WR7vvEJ+wSCgCM7oicXs+8brLtaTDnmFC/NrcC5+tNxzUwuHyFnLVQXBgWF2blZ3qavMRD9YRz68vc52RpVfYDBQmi01rVgPJwJOmnkB/K0cD6PY+iMrk0X+bmYA4JaQw3d8ytcGfc7uL7+D97JVwCReYt0NADBuHMcNhW9NAlFEIJCWIaKpzOvYJW5TUvUGBgBJgGza+2VDie+Pw4/ZYh7vwjEn7OvQqwSHQRg7vHsY+tspjGrVTKjQUNtiJoygnv/Qpm/0026vRQZiNcAAwfYLjtPO5uF9mp3m1x3Py+EOlkL+nd03HwGMnmoXnAI6SH6VIM0eJc4kNhakQytm5JESJa19+a3HE6Seyf/jAktcEzUJMMej2sdDzcF7q5JcFxQxlaGwxVgLt8XDFzxDpnO0QaAKokL+oakacS1IjzRD3nLnELS7EbNBr2ika1EA9ICtsEQnvzUYo1uXuHji5h6NKGlbWJ5+9o6N2FrNNC3CGjnEmJVz0XGHEOEcnoSnWOVls+ORqSUDP698FEMnl+jSLx+RHfSla/yMa4Kw5JGHSZG3rjwgzY2akAnmH0fTmSz9B2pXlsyEdvUiE4r870xlwAcZJYqUEEzzWWBI45zLlqx4IAtX4s7Zg4JjB/YioxITMTXZe0UCH73Z3o8=----ATTACHMENT:----OTQ4OTg0ODUxNjU4ODgzOSAzMTcyNjM4MDIxMTQ0ODUyIDcyNjIwNjM0MDk2OTQ1MDU=