* * 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:----rezr2ejrsXqrAoWJD8zjOFG/dn4skHMQs38i149JiEvXFY6+U6zfo47CAzAUgFWHnnng17qAvI17OHYeqBAzJ6MEH5gpuYg97dTmzqWmQSosWyvp5x360oFLPqgwVbq4qxFsPe9VsBg4809+2AwGl1WaiqC/pQtzBuejwPSVWG9+5q4Q8l62UpQw/dCUeB11ffIw+eavwMxq921TFe413Y1wihBXb+S85e2wyPuXUsEAgQxGcowbBSf+RRfKAYbJZe8dG2G3X1RJ4CdnIjSfewVb13y2cKGXqPHcPDajQ4QkWjyMokWgspYrSfYzKWO9ht67eW44L7ptmuciH+3MHeR0lVdF6WHDV9UrR356456CzeN1USEt2KrG5sOgJnJZNS6uvhQrwUBTQ0lC0oqZsRq68Wc4DfZ4yoojc+dg87s+w+aSMc10oWXoJ9ZmtFZRmM7rYp7wocP7HEEUiN7Puy+iyHIWn6kzvVyK2YoJ667tiK8FxPujY1JRex/eU2XU5FYA/4YTfEHSMmcH7d3VzhuQBbqNfFx8Gd04ixJqz8M/DerR0haEzHx6LIoZSZapDBfCBIzkIof66wg+y+Tgvfnb0mrjg/lFeitcXLhSE5xjjRVJKSe/53X8hSAVD6UFLBjzlqq8pZQJ+biT+7I6pO8jEIHcgJGrzz+2yXIJgtc=----ATTACHMENT:----Mzk3NzIzMzg4Njk5NTk4IDc1OTcxMDAxMDE0NTk4NTggMjYzMzcwMjU5MDg1NzUyMw==